Skip to content
Advertisement

Replacing a null value with the next null value in dataframe column [closed]

I am looking to replace all null and subsequent nulls in a pandas dataframe with the next non null value that is in the column:

JavaScript

The final dataframe should be the same as the output from the following:

JavaScript

Any help would be greatly appreciated, thanks in advance

Frank

Advertisement

Answer

You can use:

JavaScript

Or you can use also as suggested by @G. Anderson :

JavaScript
User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement