I am using the following code:
video_df_x.loc[:, 'duration'] = pd.to_datetime(video_df['datetime_2']) - pd.to_datetime(video_df_x['datetime_1'])
The code runs but gives me the following warning:
C:\Program Files\Anaconda3\lib\site-packages\pandas\core\indexing.py:337: SettingWithCopyWarning: A value is trying to be set on a copy of a slice from a DataFrame. Try using .loc[row_indexer,col_indexer] = value instead
I do not understand why I receive this error, since I am already using .loc
in my code, which is recommended in the warning message.
Any insights?