Quantcast
Channel: How to replace NaN column value with the previous column value in pandas dataframe? - Stack Overflow
Browsing index pages (2 articles)
↧

How to replace NaN column value with the previous column value in pandas...

I am trying to merge two dataframes that does not have equal number of rows or columns. It results in NaN values. I want to fill this NaN values with the previous value in the column.import pandas as...

View Article


Answer by INGl0R1AM0R1 for How to replace NaN column value with the previous...

In this case all you need is the ffill() methodresult = pd.merge(df1, df, how='outer').ffill() # Will give your wanted series

View Article

Browsing index pages (2 articles)


Latest Images