Answers for "set date index pandas"

1

pandas dataframe set datetime index

df['Datetime'] = pd.to_datetime(df['date'] + ' ' + df['time'])
df = df.set_index('Datetime')
Posted by: Guest on June-15-2020
1

change freq of date index in pandas

#Change freq of df DateTimeIndex into a monthly freq
df.asfreq('M')
Posted by: Guest on August-10-2021

Python Answers by Framework

Browse Popular Code Answers by Language