Guided Project: Exploring Ebay Car Sales Data, Don't understand the warning sign

Hi all,

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:

"/dataquest/system/env/python3/lib/python3.4/site-packages/pandas/core/ 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:
self.obj[item] = s"

What does the warning sign mean and how could I change my code? Thank you!


Hi @wtche17

Welcome to our Dataquest Community.

Go through the below post, it may help you to get your answer and understand the warning SettingWithCopyWarning .

Thanks a lot Premchandra! I got it!

1 Like