I had a data where my time was in UNIX format. I used the following code to convert my time in dataframe to Date format from Unix.
import pandas as pd
df = pd.read_csv(r'C:\Users\My Computer\Desktop\Data Analysis\BATS_SPY, 1D.csv')
df['time'] = pd.to_datetime(df['time'],unit='s')
print(df.head())
I get the result as
time
0 1993-01-29 14:30:00
1 1993-02-01 14:30:00
2 1993-02-02 14:30:00
3 1993-02-03 14:30:00
4 1993-02-04 14:30:00
What should I do if I only want dates (that is I want to exclude 14:30:00 from the time)
My data was as follows
time
0 728317800
1 728577000
2 728663400
3 728749800
4 728836200
Take your date series:
df['date'] = df['time'].dt.floor('D')