Я составил два dicts, чтобы показать вам поведение:
areadict = {'one': 1, 'two': 2, 'three': 3}
methoddict = {'_one': 11, '_two': 22, '_three': 33}
df = pd.DataFrame([0, 0, 0])
for key in areadict:
for key2 in methoddict:
df[key + key2] = areadict[key]
дает нам:
0 one_one one_two one_three two_one two_two two_three three_one three_two three_three
0 0 1 1 1 2 2 2 3 3 3
1 0 1 1 1 2 2 2 3 3 3
2 0 1 1 1 2 2 2 3 3 3
Установка df[key + key2]=''
также работает. Мы можем получить к нему доступ с помощью df['one_two']
, что приводит к
0 1
1 1
2 1
Name: one_two, dtype: int64