Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

pandas fill nan methods

# axis=1 means fillna by rows
df = df.fillna(axis=1, method='backfill')
df = df.fillna(axis=1, method='ffill')

# methods
# pad / ffill: propagate last valid observation forward to next valid.
# backfill / bfill: use next valid observation to fill gap.
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #pandas #fill #nan #methods
ADD COMMENT
Topic
Name
3+5 =