I have timestamp in my data of this format 2021-12-01 19:00:00 00:00 ,
I am applying isolation forest to label the data and i tried the code but got error ValueError: could not convert string to float: '2018-12-01 17:00:00 00:00'
CodePudding user response:
Try to convert timestamp
column as int:
df['timestamp'] = df['timestamp'].astype('datetime64').astype(int)
CodePudding user response:
Adding parse_dates=[<columns>]
to pd.read_csv
will cause Pandas to automatically convert strings that look like dates to actual datetime objects:
df = pd.read_csv('C:/Users/Desktop/labeling/fCCC.csv', parse_dates=['timestamp'])
df['timestamp'] = df['timestamp'].astype('int')