小编Dat*_*tor的帖子

为什么两个数据帧的 pd.concat() 会导致 FutureWarning:连接 bool-dtype 时的行为?

项目清单

我想连接两个数据框,pd.concat()如下所示:

if (not df_1.empty) | (not df_2.empty):
    new_df= pd.concat([df_1, df_2]) 
Run Code Online (Sandbox Code Playgroud)

它返回以下警告:

FutureWarning: Behavior when concatenating bool-dtype and numeric-dtype arrays is deprecated; in a future version these will cast to object dtype (instead of coercing bools to numeric values). To retain the old behavior, explicitly cast bool-dtype arrays to numeric dtype.
Run Code Online (Sandbox Code Playgroud)

我也读过这个DataFrame问题,但这里我有一个包含str不同类型的数字(int,float)。这种情况我该怎么办?

这是每个数据帧的样本数据:df_1:

约会时间 进入率 停止 限制 数量 标准批次 货币名称 买
2022年3月11日 11:24 1.31006 0 0 5000 0.05 英镑兑美元 …

python pandas

9
推荐指数
1
解决办法
7119
查看次数

标签 统计

pandas ×1

python ×1