Skip to content

Instantly share code, notes, and snippets.

@GurjotSinghMahi
Created February 18, 2021 15:57
Show Gist options
  • Save GurjotSinghMahi/bc5d239046931b8126181f5c2d2b07a8 to your computer and use it in GitHub Desktop.
Save GurjotSinghMahi/bc5d239046931b8126181f5c2d2b07a8 to your computer and use it in GitHub Desktop.
# read the csv file and parse the dates
df = pd.read_csv("raw_data.csv", parse_dates=['SubmissionDate', 'starttime', 'endtime'])
df['hour'] = df['SubmissionDate'].dt.hour
df['minute'] = df['SubmissionDate'].dt.minute
df['seconds'] = df['SubmissionDate'].dt.second
# Remove Date from SubmissionDate Column
df['Time'] = pd.to_datetime(df['SubmissionDate']).dt.time
print(tabulate(df[['Time', 'hour', 'minute', 'seconds']], headers = 'keys', tablefmt = 'psql'))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment