目的
特定条件の項目に対して列と値を追加
コード
import pandas as pd
input_file = pd.read_csv('test.csv')
print(input_file)
input_file.loc[(input_file['name'] == 'Akebono') & (input_file['Weight'] == 90), 'Age'] = '31'
print(input_file)
出力結果
name Height Weight
0 Akebono 170 65
1 Shota 171 59
2 Akebono 169 90
3 Yamato 175 50
name Height Weight Age
0 Akebono 170 65 NaN
1 Shota 171 59 NaN
2 Akebono 169 90 31
3 Yamato 175 50 NaN