【发布时间】:2022-01-19 21:19:23
【问题描述】:
我正在尝试制作一个简单的脚本,它应该获取项目的 id 并获取一些与之关联的统计数据并将其添加到数据框中。
stats = ['info_attack', 'info_defense', 'info_magic', 'info_difficulty', 'stats_hp', 'stats_hpperlevel', 'stats_mp', 'stats_mpperlevel',
'stats_movespeed', 'stats_armor', 'stats_armorperlevel', 'stats_spellblock', 'stats_spellblockperlevel', 'stats_attackrange',
'stats_hpregen','stats_hpregenperlevel', 'stats_crit', 'stats_critperlevel','stats_attackdamage','stats_attackdamageperlevel',
'stats_attackspeedperlevel', 'stats_attackspeed']
ngrams = pd.concat([champItemMonoCombinations,champItemBiCombinations,champItemTriCombinations, champItemFourCombinations, champItemPentaCombinations,champItemSexCombinations ])
for stat in stats:
print(stat)
ngrams[stat] = ngrams['ChampionID'].map(champDataFrame.set_index('key')[stat])
它返回 nan 我不知道为什么
编辑:我将存储在一个数据帧中的整数与另一个数据帧中的字符串进行比较。现在效果很好
【问题讨论】: