Skip to content

Instantly share code, notes, and snippets.

@AlexandraKapp
Last active October 10, 2019 14:08
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 AlexandraKapp/237093f4b0403c4fa741bce559c81568 to your computer and use it in GitHub Desktop.
Save AlexandraKapp/237093f4b0403c4fa741bce559c81568 to your computer and use it in GitHub Desktop.

merge two dfs on specific key

df.set_index('key').join(df2.set_index('key'))

get datetime from String

pd.to_datetime(df['date'],format='%Y-%m-%d')

get weekday of datetime

  • with numbner (0 Monday - 6 Friday)
 df.datetime_column.weekday()
  • with day
df.datetime_column.day_name()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment