Removing outliers for Ebay Car Sales data


I think there is something wrong with the way I coded to get rid of the outliers, but I don’t know what I did wrong.

@dgny90: I think you have to convert the price data from string to int when you load the data into the notebook, before using the .between() method.

I already converted all the values in price to integers. This is the code written above.

autos[‘price’] = autos[‘price’].str.replace(’$’,’’).str.replace(’,’,’’).astype(int)

Hmm ok. Could you export and provide us with the entire notebook? (because you had only screenshot one portion of it) Perhaps @Rucha could assist with this too… Thanks!

Guided Project_ Exploring Ebay Car Sales (2.4 MB)

Thank you :slight_smile:

hey @dgny90

This part of the code results in a dataframe - autos[autos['price'].between(0,3000000)]- like as below:

when you assign it to autos['price'] you are trying to assign an entire dataframe to one single column/ field which will surely give you an error!

corrected code should be like df = df[df['series'].between(n,m)]

also, uploading your project file using the method mentioned in this post will enable other community members to help you faster.

1 Like