Skip to content

Instantly share code, notes, and snippets.

@liannewriting
Created January 21, 2020 19:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save liannewriting/a46cf1a120122c7b3b6db3edbf1fb67b to your computer and use it in GitHub Desktop.
Save liannewriting/a46cf1a120122c7b3b6db3edbf1fb67b to your computer and use it in GitHub Desktop.
data_cleaning_202001
df['timestamp_dt'] = pd.to_datetime(df['timestamp'], format='%Y-%m-%d')
df['year'] = df['timestamp_dt'].dt.year
df['month'] = df['timestamp_dt'].dt.month
df['weekday'] = df['timestamp_dt'].dt.weekday
print(df['year'].value_counts(dropna=False))
print()
print(df['month'].value_counts(dropna=False))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment