I try to fill the missing values in Critic Score by grouping 'Name'.
games['Rating'] = dupliacted_games.groupby('Name')['Rating'].apply(
lambda x: x.fillna(x.value_counts().idxmax()
if x.value_counts().max() >=1
else mode , inplace = False)
)
games['Rating'].fillna(
dupliacted_games['Rating'].value_counts().idxmax(),inplace=True
)
I get this error :
site-packages\pandas\core\generic.py:6287: SettingWithCopyWarning: A value is trying to be set on a copy of a slice from a DataFrame See the caveats in the documentation: http://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy self._update_inplace(new_data)