2021年1月22日星期五

How to fill in missing values in Pandas dataframe according to pattern in column?

Suppose I have a dataframe with a column as follows:

Column  10  NaN  20  NaN  30  

I want each row to be filled in with increments of 5 so that the final output would appear like:

Column  10  15  20  25  30  

I've tried using np.arange and .reindex() but haven't had much luck. I'm looking for an iterative approach instead of simply manually filling in. Can anyone please help with this?

https://stackoverflow.com/questions/65855938/how-to-fill-in-missing-values-in-pandas-dataframe-according-to-pattern-in-column January 23, 2021 at 01:08PM

没有评论:

发表评论