Linked Questions

Popular Questions

datetime combine date & time stamp

Asked by At

Im trying to use this SO post to combine a date and time stamp but not having any luck..

#df= pd.read_csv('C:\\Users\\desktop\\master.csv', index_col='Date', parse_dates=True)
df= pd.read_csv('C:\\Users\\desktop\\master.csv')

This is where Im stuck, I don't know how to import the package correctly..

This doesn't work: from datetime import combine

df['DateTime'] = df.apply(lambda x: combine(df['Date'], df['Time']), axis=1)

When everything is all said and done, do I need to parse_dates=True? Usually all my data is a combined date time... and Finally I need to set a new index in my pandas data frame for the new combined date-time column.

Any tips greatly appreciated thanks

Related Questions