Pandas Find Last Non NAN Value
I have a pandas data frame where the columns are dates and each row is an independent time series. I try to get the last value of each row using the following: df['last'] = df.il
Solution 1:
Get last non NaN
value in each row of a dataframe:
df['last_value'] = df.ffill(axis=1).iloc[:, -1]
print (df)
Post a Comment for "Pandas Find Last Non NAN Value"