Skip to content

Instantly share code, notes, and snippets.

@GurjotSinghMahi
Last active February 18, 2021 14:00
Show Gist options
  • Save GurjotSinghMahi/3a01a47e5ebf1db5d9ecf30a2fce6657 to your computer and use it in GitHub Desktop.
Save GurjotSinghMahi/3a01a47e5ebf1db5d9ecf30a2fce6657 to your computer and use it in GitHub Desktop.
# Convert Date to respective day name
df['Date'] = (df['Date']).astype('datetime64[D]')
# convert Date to day name
df['Day'] = df['Date'].dt.day_name()
df['Date'] = pd.to_datetime(df['Date']).dt.date
# Print the dataframe
print(tabulate(df[['Date', 'Day', 'user_id', 'gadget']], headers = 'keys', tablefmt = 'psql'))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment