Understanding inplace=True

后端 未结 11 1089
遥遥无期
遥遥无期 2020-11-22 03:25

In the pandas library many times there is an option to change the object inplace such as with the following statement...

df.dropna(axis=\'index\         


        
11条回答
  •  孤独总比滥情好
    2020-11-22 03:34

    Save it to the same variable

    data["column01"].where(data["column01"]< 5, inplace=True)

    Save it to a separate variable

    data["column02"] = data["column01"].where(data["column1"]< 5)

    But, you can always overwrite the variable

    data["column01"] = data["column01"].where(data["column1"]< 5)

    FYI: In default inplace = False

提交回复
热议问题