Answer by Ashwin Agarwal for How to replace NaNs with some change in previous...
You can try this as well:df = df.fillna(df.fillna(method='ffill').add(10))I find this method easier.
View ArticleAnswer by anky for How to replace NaNs with some change in previous values in...
You can shift the dataframe and then add 10 , then fillna with that df:df = df.fillna(df.shift().add(10))# for a new df :-> new_df = df.fillna(df.shift().add(10))print(new_df) 0 1 20 10 20.0 301 40...
View ArticleHow to replace NaNs with some change in previous values in Pandas DataFrame?
0 1 20 10 20 301 40 NaN 602 50 55 903 60 NaN 804 70 75 90What I need to do is replace every NaN value with 30 , 65 respectively. That means ten added to previous value
View Article
More Pages to Explore .....