熊猫串联导致NaN?

锡罐

看起来很简单的函数返回的是NaN,而不是实际的数字。我在这里想念什么?

#Concatenate the dataframes:
dfcal = dfcal.astype(float)
dfmag = dfmag.astype(float)
print('dfcal\n-----',dfcal)
print('dfmag\n-----',dfmag)
df = pd.concat([dfcal,dfmag])
print('concatresult\n-----',df)

在此处输入图片说明

干杯!

耶斯列尔

我想您需要axis=1追加新列,caliper为避免重复的depth,请选择列:

df = pd.concat([dfcal['caliper'],dfmag], axis=1)

要么:

df = pd.concat([dfcal.drop('depth', axis=1),dfmag], axis=1)

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章