导入:

    1. import pandas as pd
    2. import numpy as np
    3. from numpy import nan as NaN

    填充同样的内容:

    1. df1.fillna(100)

    每一列填充不一样的内容:

    1. dict = {0:10,1:20,2:30}
    2. df1.fillna(dict)
    3. # 0列,1列,2列

    直接修改原数据:

    1. df1.fillna(0,inplace=True)
    2. df1

    修改填充方向:

    1. df2.fillna(method="ffill",limit=1,axis=1)

    ref:https://blog.csdn.net/haoxun05/article/details/104563911

    1. DataFrame.fillna(value=None, method=None, axis=None, inplace=False, limit=None, downcast=None, **kwargs)


    parameters details
    value 被填充的数据,scalar、dict、Series、DataFrame
    method backfill、bfill、pad、ffill
    axis 0-index,1-columns修改填充方向
    inplace default False,if True means 修改原文件
    limit 限制填充个数

    ref:https://blog.csdn.net/The_Time_Runner/article/details/84102428