You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Pandas中不同DataFrame列相乘返回全NaN的问题排查

DataFrame多列与另一DataFrame列相乘返回全NaN的原因排查

我有两个DataFrame,需要将dataframe1的指定多列与dataframe2的mass_frac列相乘,但执行以下代码后结果全为NaN,且所有列均为数值型字段:

raw_material_LCI = dataframe1[["climate change","ozone depletion",
              "ionising radiation, hh","photochemical ozone formation, hh",
              "particulate matter","human toxicity, non-cancer",
              "human toxicity, cancer","acidification",
              "eutrophication, freshwater","eutrophication, marine",
              "eutrophication, terrestrial","ecotoxicity, freshwater",
              "land use", "resource use, fossils","resource use, minerals and metals",
              "water scarcity"]] * dataframe2["mass_frac"]

但如果将这些列与单个数值0.7相乘,却能得到正常的数值结果:

raw_material_LCI = dataframe1[["climate change","ozone depletion",
              "ionising radiation, hh","photochemical ozone formation, hh",
              "particulate matter","human toxicity, non-cancer",
              "human toxicity, cancer","acidification",
              "eutrophication, freshwater","eutrophication, marine",
              "eutrophication, terrestrial","ecotoxicity, freshwater",
              "land use", "resource use, fossils","resource use, minerals and metals",
              "water scarcity"]] * 0.7

我查阅了多篇相关文章仍未找到解决办法,想请教该问题的原因是什么?


内容的提问来源于stack exchange,提问作者BlueRhino254

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.08.03 12:02:42