Answers for "python add date index to dataframe"

0

pandas add days to date

## get the timestamp 5 days later the beginning one
from datetime import timedelta

pd.to_datetime('2020-11-28') + timedelta(days=5)

Timestamp('2020-12-05 00:00:00')
Posted by: Guest on April-07-2021
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

Code answers related to "python add date index to dataframe"

Python Answers by Framework

Browse Popular Code Answers by Language