完美解决TypeError: concat() got an unexpected keyword argument ‘join"/>
完美解决TypeError: concat() got an unexpected keyword argument ‘join
完美解决TypeError: concat() got an unexpected keyword argument ‘join_axes‘
下滑查看解决方法
文章目录
- 报错问题
- 解决思路
- 解决方法
- 交流
报错问题
TypeError: concat() got an unexpected keyword argument ‘join_axes‘
解决思路
对于这个错误,TypeError: concat() got an unexpected keyword argument ‘join_axes‘,出现这个错误的原因是因为在 pandas.concat 函数中使用了不支持的参数 join_axes。
解决方法
下滑查看解决方法
在较新的版本中,join_axes 参数已被废弃,可以使用 reindex 方法替代。以下是解决该问题的方法:
检查你所使用的 pandas 版本,确保是较新的版本。
找到使用了 concat() 函数,并且指定了 join_axes 参数的地方。
将 join_axes 参数修改为 reindex 方法,如下所示:
# 替换前
result = pd.concat([df1, df2], join_axes=[df1.columns])# 替换后
result = pd.concat([df1, df2]).reindex(columns=df1.columns)
通过这种方式,你可以避免使用不支持的 join_axes 参数,并且实现相同的功能。
以上内容仅供参考,具体问题具体分析,如果对你没有帮助,深感抱歉。
交流
对软考有兴趣的朋友可以进博主的交流群,目前有软件设计师、高项、系统架构师、系统分析师四个群。
- 群内有历年真题、电子书等资料可以自取;
- 无营销、纯交流群;
- 每周会有两次送书活动一次三本,包邮到家。
交流入口
更多推荐
完美解决TypeError: concat() got an unexpected keyword argument ‘join
发布评论