Skip to content

Instantly share code, notes, and snippets.

@brinnaebent
Created November 17, 2020 14:24
Show Gist options
  • Save brinnaebent/aae5074f56b82854619b008706d5b804 to your computer and use it in GitHub Desktop.
Save brinnaebent/aae5074f56b82854619b008706d5b804 to your computer and use it in GitHub Desktop.
# We will use pd.to_datetime() to convert the Time column to a datetime object. We need to tell Python what the current format is.
df['DateTime'] = pd.to_datetime(df['DateTime'], format='%Y-%m-%dT%H:%M:%S')
# I would also like to make a new column, "Day", with just the Day of the DateTime column.
df['Day'] = df['DateTime'].dt.date
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment