python - 获取属性错误:系列对象没有属性“爆炸”
问题描述
我正在尝试运行我正在使用explode() 的python 脚本。在我的本地它工作正常,但是当我尝试在服务器上运行时它会出错。
我正在使用以下代码:
df_main1 = (df_main1.set_index(['rule_id', 'applied_sql_function1', 'input_condition', 'input_value', 'and_or_not_oprtor', 'output_condition', 'priority_order']).apply(lambda x: x.astype(str).str.split(',').explode()).reset_index())
我得到的错误:
("'Series' object has no attribute 'explode'", u'occurred at index comb_fld_order')
解决方案
问题是熊猫的不同版本,因为Series.explode
仅在更高版本中工作:
0.25.0 版中的新功能。
推荐阅读
- ios - 在 SwiftUI 中使用包装的 UIKit 选项卡视图在按钮按下时切换选项卡
- adobe - 如何设置 Adobe 分析?
- c# - ARM 上用于 HoloLens 2 的 gRPC 支持
- ffmpeg - 无法在 buildozer 或 p4a 中构建 FFmpeg
- c# - Google Drive Auth2:如何修复错误 400:redirect_uri_mismatch
- python - 如何创建一个猜数字游戏(机器猜用户正在想的数字)
- python - 使用 pynput 键入冒号 (:)
- java - 从 txt 文件中读取矩阵
- sql-server - 如何在部分百分比的 SELECT 语句中避免 SELECT COUNT
- azure-media-services - 使用实时字幕流式传输