Reputation: 33
I have a IMDB data frame that looks like that : IMDB data frame
I want to change all ratings and metascore with below 100,000 votes to NaN
.
Here is my attempt :
df[(df['votes']<100000)].loc[:, ['rating', 'metascore']] = np.nan
I'll be happy to get some help here. Thanks!!
Upvotes: 0
Views: 59
Reputation: 1572
Your code seems OK. You might check though if you have missing values in columns votes
, metascore
and ratings
. I see all these columns are float
. If you have mising values in votes
you might have a problem so you should try to make :
df['votes'] = df['votes'].fillna(0.0)
Upvotes: 1