Applying formats to compued vars

Offen
#175 1 Kommentar 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Dieses Issue hat noch niemand übernommen.

Bewertung

Schwierigkeit
3/5
Geschätzter Aufwand
1-2 Tage
Anfängerfreundlichkeit
35/100
Issue-Typ
Bug
Klarheit
Größtenteils klar
Aktivitätsstatus
Veraltet
Tech-Stack
python
Bereich
api, data

Rechercherichtung

Beginnen Sie damit, die bereitgestellte Python-Reproduktion mit CASTable, computedvars, columnInfo() und dem gefilterten head()-Aufruf auszuführen. Verfolgen Sie, wie sich das Anwenden des Formats auf die berechnete Zeitspalte auf nachfolgende Tabellenoperationen auswirkt, und betrachten Sie das Problem als abgeschlossen, wenn das Format beibehalten wird, während das Filtern von tbl nach price weiterhin erfolgreich ausgeführt wird.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Beschreibung

Hi,

it would be very helpful if formats could be applied to computed variables - especially when working with date/time columns. The functionality seems to be there, but it's breaking the table reference.

Example: Based on a datetime column I can successfully add a time column that holds the hour of the datetime column.

# example table
conn.datastep.runCode(
	code =
	'''data test;
		format datetime e8601dt19.;
		datetime = dhms("03mar2024"d, 9, 50, 0);
		price    = 101.4;
		output;
		datetime = dhms("03mar2024"d, 10, 20, 0);
		price    = 102.5;
		output;
	run;''',
	single = 'yes'
)
tbl = conn.CASTable('test')

# add column containing the hour of the datetime column
tbl['time'] = tbl['datetime'].dt.hour*60*60

# apply time format to new column
tbl.computedvars = [{'name':'time', 'format':'time8.'}]

# check if time format was applied
tbl.columnInfo()

image

# check if time format works
tbl.head()

image

Unfortunately, after applying the format as shown above, I can't execute any operations on the table anymore:

tbl[tbl['price']>=102].head()

image

Vorherrschende Sprache
Python
Sterne
159
Forks
66
PR-Merge-Kennzahlen
Keine gemergten PRs in 30 T.

Entwicklungsumgebung

Erste Schritte

  1. Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
  3. Forken Sie das Repository und arbeiten Sie in einem Branch.
  4. Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.

Mehr aus sassoftware/python-swat

Alle Issues in sassoftware/python-swat

Ähnliche Issues

Weitere Issues zu Python

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.