Discussion Forum | Board Infinity

Unable to remove the outlier

@ankur-kumar-30985975. This error is not regarding outlier. It is because you are comparing 2 wrong dtypes. One is series and other i guess int

sir both are in float… i guess

Both are Showing series data type sir

check this

Sir I saw that but didn’t understand

https://drive.google.com/file/d/16BiFIRBIcDTbDyADrK0eq1z8siI81xtZ/view?usp=sharing

import pandas as pd

import numpy as np
import matplotlib as mlt
import matplotlib.pyplot as plt
import seaborn as sns

data = pd.read_excel(“Tips.xlsx”)

data.drop(data.index[244],inplace=True)

max_threshold1=data.total_bill.quantile([0.95])
max_threshold2=data.tip.quantile([0.95])

data.total_bill< max_threshold1

Clnd_data=data[(data.total_bill < max_threshold1) & (data.tip < max_threshold2)]

type(data.total_bill)

I got your problem… the issue is because of max_threshold 1… It has index as 0.95… and data.totalbill has index as 1,2,3. Try resetting the index for max_threshold1

max_threshold1=data.total_bill.quantile([0.95])

max_threshold1.reset_index(inplace=True,drop=‘True’)
max_threshold1

data.total_bill < max_threshold1

still not happening sir, even after changing the index.

Ok
Try this approach
It worked for me

import pandas as pd
import numpy as np
import matplotlib as mlt
import matplotlib.pyplot as plt
import seaborn as sns

data = pd.read_excel(‘Tips.xlsx’)

data.drop(data.index[244],inplace=True)

max_threshold1=data[‘total_bill’].quantile(0.95)
max_threshold1

data.total_bill < max_threshold1

I tried this too previously but didn’t work. It worked only once, after I changed the name it stopped working and started giving error. I’m unable to understand the error.

share the notebook with errors

http://localhost:8888/notebooks/Untitled11.ipynb