I am trying to clean my dataset. It has few columns which have all String/float/int (for name/pay/overtimepay) values but few rows contain 'Not provided' as a value.
newData = data[~data['BasePay'].isin(['Not Provided'])]
newData = data[~data['BasePay'].str.contains('Not Provided', na=False)]
print(newData['BasePay'].mean())
and
df = data.select_dtypes(object)
mask = ~df.apply(lambda series: series.str.contains('Not Provided')).any(axis=1)
no_eco = data[mask]
to clean the column of 'BasePay' and calculate mean but failed. I'd appreciate if you could help. Image of the concerned rows in my dataset