pandas dataframe modify the value according to the filter result

Example:
This is based on 列1 == '旧值'this condition, the 列2designated new value

df.loc[df[(df.1 == '旧值')].index.tolist(),'列2'] = '新的值'

Guess you like

Origin blog.csdn.net/weixin_35757704/article/details/115001655
Recommended