Sign up to take part
Registered users can ask their own questions, contribute to discussions, and be part of the Community!
Registered users can ask their own questions, contribute to discussions, and be part of the Community!
Hi,
While running a python code: this is the snippet of the code
datadump_df['TIME'] = pd.to_datetime(datadump_df['TIME'])
datadump_df.set_index('TIME', inplace=True)
datadump_df = datadump_df.resample('200ms').first()
datadump_df.loc[datadump_df['ROP_15MIN'] == 6553.0, 'ROP_15MIN'] = np.nan
Kindly suggest.
Thanks,
Parul.
Hi @Parul_ch,
The problem is that you might have empty or null values in the column 'TIME' that you want to convert to a datetime.
pd.to_datetime, by default, won't continue to parse the dates and it will raise an error. Several options are available depending on what you need:
pd.to_datetime(datadump_df['TIME'], errors='coerce')
This will ignore the error when parsing null values, and it will set those as NaT
Hope this helps!