“panda hari kerja” Kode Jawaban

Konversi datetime panda ke hari, hari kerja, bulan

#Convert datetime column/series to hour of the day. NB: Column must be in datetime format.
df['hour'] = df['column_name'].dt.hour
#Convert datetime column/series to day of the week
df['day'] = df['column_name'].dt.weekday
#Convert datetime column/series to month
df['month'] = df['column_name'].dt.month
#Convert datetime column/series to year
df['year'] = df['column_name'].dt.year
#NB: Weekday/Month will be in int. Eg. for months, January=1, February=2...etc,
Kwams

panda hari kerja

df['date_time'].dt.dayofweek #gives only the index(0-monday,6-sunday)
df['date_time'].dt.weekday_name #gives the day
Lazy long python

Jawaban yang mirip dengan “panda hari kerja”

Pertanyaan yang mirip dengan “panda hari kerja”

Lebih banyak jawaban terkait untuk “panda hari kerja” di Python

Jelajahi jawaban kode populer menurut bahasa

Jelajahi bahasa kode lainnya