Answers for "Convert the date index to datetime using pandas's to_datetime(). datacamp"

0

pandas index to datetime

import pandas as pd
df = pd.Dataframe(data)
df.index = pd.DatetimeIndex(data=df.index, tz='US/Eastern') # naive--> aware
df.index = pd.DatetimeIndex(df.index.tz_convert('US/Pacific')) # aware--> aware
df
Posted by: Guest on June-27-2021

Code answers related to "Convert the date index to datetime using pandas's to_datetime(). datacamp"

Python Answers by Framework

Browse Popular Code Answers by Language