I was doing the project and dealing with the date_scrawled column. I was trying to calculate the frequency of ad scrawled from unique values.
My code is as follows:
#Dealing with date_scrawled
autos_price99.loc[:, ‘date_crawled’] = pd.to_datetime(autos_price99.loc[:, ‘date_crawled’])
autos_price99.loc[:, ‘date_crawled’] = autos_price99.loc[:, ‘date_crawled’].dt.strftime(’%Y-%m-%d’)
print(autos_price99[‘date_crawled’].value_counts(normalize = True, dropna = False).sort_index())
The code functioned well, but I always got warnings like below:
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: http://pandas.pydata.org/pandas-docs/stable/indexing.html#indexing-view-versus-copy
self.obj[item] = s"
What does the warning sign mean and how could I change my code? Thank you!