Answers for "pandas fillna by rows"

6

fillna with mean pandas

sub2['income'].fillna((sub2['income'].mean()), inplace=True)
Posted by: Guest on July-22-2020
0

dataframe fillna with 0

df['column'] = df['column'].fillna(0)
Posted by: Guest on January-21-2021
0

pandas fillna by rows

# for the whole dataframe
df = df.fillna(axis=1, method='backfill')
# only for some columns
df[['A', 'B', 'C']] = df[['A', 'B', 'C']].fillna(axis=1, method='backfill')
Posted by: Guest on February-17-2022

Python Answers by Framework

Browse Popular Code Answers by Language