DEV Community

GharamElhendy
GharamElhendy

Posted on

Returning index of day names with Pandas

In the code, I wanted to extract the month and day of the week to create a new column.

The old code was:
df['day_of_week'] = df['Start Time'].dt.weekday_name

The updated code:
df['day_of_week'] = df['Start Time'].dt.day_name()

The repo containing the code: https://github.com/GharamElhendy/Bike-Share-Data-Project

Top comments (0)