首页 > 解决方案 > 获取属性错误:系列对象没有属性“爆炸”

问题描述

我正在尝试运行我正在使用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')

标签: pythonpython-3.xpandasdataframe

解决方案


问题是熊猫的不同版本,因为Series.explode仅在更高版本中工作:

0.25.0 版中的新功能。


推荐阅读