I have a column called 'Country' and there are quite a lot '?' as values I tried to convert them to NAN but the values are not changing. This is my code.
df['Country'].value_counts()
United-States 29170
Mexico 643
? 583
Philippines 198
Germany 137
df[df['Country']=='?'] = np.nan
df['Country'].isnull().sum()
0
And i also tried using replace function.
df['Country'].replace('?', np.nan)
And I also tried
df = pd.read_csv('train.csv', na_values=['?'])
And even if I try to print all the rows where country values are '?'
it gives empty dataframe. I don't know how to solve this. Can someone please help me.
Thanks