I have not received this copy warning with other functions and I have not found a way to address it.
Here is my code:
div_df.loc[:,"Ann.Date"] = pd.to_datetime(div_df.loc[:,"Ann.Date"], format='%d %b %Y')
/volume1/homes/id/venv/lib/python3.8/site-packages/pandas/core/indexing.py:1843: 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
See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy
self.obj[item_labels[indexer[info_axis]]] = value
I have not found a solution anywhere other than the following:
div_df.loc[:,"Ann.Date"] = pd.to_datetime(div_df.loc[:,"Ann.Date"], format='%d %b %Y', errors='coerce')