Category : fillna

I have a dataframe of numbers such as: A B 2019-10-31 0.035333 2019-10-31 NaN 2019-11-30 -0.108532 2019-11-30 -0.030604 2019-11-30 NaN I want to replace the NaN’s in column B with a random gaussian number: from random import seed from random import gauss # seed random number generator seed(1) # generate some Gaussian value value = ..

Read more

I have several null values in a column: print(df[‘col’].isnull().sum(axis = 0)) I am trying to replace them like this: df[‘col’].fillna(value=’no_val’) #df[‘col’].value_counts() print(df[‘col’].isnull().sum(axis = 0)) but it doesn’t work and still shows the same number of null values after using .fillna as well. If I change it like this: df = df[‘col’].fillna(value=’no_val’) it would start giving ..

Read more