Skip to content

Instantly share code, notes, and snippets.

@marufeuille marufeuille/dt.py
Created Feb 12, 2020

Embed
What would you like to do?
e_set("timestamp",dt_totimestamp(dt_parse(v("dteday"))))
e_if(
e_search("weathersit==1"), e_set("good", 1, "normal", 0, "bad", 0, "terrible", 0),
e_search("weathersit==2"), e_set("good", 0, "normal", 1, "bad", 0, "terrible", 0),
e_search("weathersit==3"), e_set("good", 0, "normal", 0, "bad", 1, "terrible", 0),
e_search("weathersit==4"), e_set("good", 0, "normal", 0, "bad", 0, "terrible", 1)
)
e_if(
e_search("weekday==0"), e_set("sunday", 0, "monday", 0, "tuesday", 0, "wednesday", 0, "thursday", 0, "friday", 0, "saturday", 0),
e_search("weekday==1"), e_set("sunday", 0, "monday", 1, "tuesday", 0, "wednesday", 0, "thursday", 0, "friday", 0, "saturday", 0),
e_search("weekday==2"), e_set("sunday", 0, "monday", 0, "tuesday", 1, "wednesday", 0, "thursday", 0, "friday", 0, "saturday", 0),
e_search("weekday==3"), e_set("sunday", 0, "monday", 0, "tuesday", 0, "wednesday", 1, "thursday", 0, "friday", 0, "saturday", 0),
e_search("weekday==4"), e_set("sunday", 0, "monday", 0, "tuesday", 0, "wednesday", 0, "thursday", 1, "friday", 0, "saturday", 0),
e_search("weekday==5"), e_set("sunday", 0, "monday", 0, "tuesday", 0, "wednesday", 0, "thursday", 0, "friday", 1, "saturday", 0),
e_search("weekday==6"), e_set("sunday", 0, "monday", 0, "tuesday", 0, "wednesday", 0, "thursday", 0, "friday", 0, "saturday", 1)
)
e_if(
e_search("season==1"), e_set("winter", 1, "spring", 0, "summer", 0, "autom", 0),
e_search("season==2"), e_set("winter", 0, "spring", 1, "summer", 0, "autom", 0),
e_search("season==3"), e_set("winter", 0, "spring", 0, "summer", 1, "autom", 0),
e_search("season==4"), e_set("winter", 0, "spring", 0, "summer", 0, "autom", 1),
)
e_drop_fields("dteday", "yr", "mnth", "temp", "weathersit", "season", "weekday")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.