Created
April 21, 2016 04:38
-
-
Save dyerrington/3b64ba0660340b6329d789e679db3268 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
data = [ | |
["2001-10-1", 2, 3, 4], | |
["2001-11-1", 2, 3, 4], | |
["2001-05-1", 2, 3, 4], | |
["2001-05-1", 2, 3, 4], | |
["2001-03-1", 2, 3, 4] | |
] | |
df = pd.DataFrame(data, columns=["date", "a", "b", "c"]) | |
df["my_date"] = pd.to_datetime(df["date"]) | |
df.dtypes | |
# Mapping specific date series to new features | |
# df["my_month"] = df["my_date"].map(lambda date: date.month) | |
# You can also do this for .year, .week, .day for date objects in series |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment