Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/291.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python pandas.Series.explode属性错误_Python_Pandas_Dataframe_Series - Fatal编程技术网

Python pandas.Series.explode属性错误

Python pandas.Series.explode属性错误,python,pandas,dataframe,series,Python,Pandas,Dataframe,Series,我正试着使用 因为我对爆炸整个数据帧不感兴趣。 我试图分解的dataframe列看起来像 df["lists"].head() 0 [cl5, bn6, sp1] 1 [cl5, bn6, sp1] 2 [cl5, bn6, sp1] 3 [bn6, sp1] 4 [bn6, sp1] Name: lists, dtype: object 我尝试了df.lists.explode().value_counts(),它抛出了

我正试着使用 因为我对爆炸整个数据帧不感兴趣。 我试图分解的dataframe列看起来像

df["lists"].head()

0    [cl5, bn6, sp1]  
1    [cl5, bn6, sp1]  
2    [cl5, bn6, sp1]  
3         [bn6, sp1]  
4         [bn6, sp1]  
Name: lists, dtype: object
我尝试了
df.lists.explode().value_counts()
,它抛出了一个AttributeError:“Series”对象没有属性“explode”。 使用
df.explode('lists')
时观察到相同的错误。我看不出它是否被弃用了,所以我不确定源代码示例也不起作用时出了什么问题

根据,此函数为

0.25.0版中的新版本


我认为您的问题可能是因为旧的软件包版本。更新pandas软件包可能会解决您的问题。

df.to_frame().explode('lists')
will您使用的pandas软件包的版本是什么?在多个环境中,如果您不确定,只需在python代码中导入pandas后打印
pandas.\uu版本\uu
。请编辑您的问题并将这些信息添加到您的问题中好吗?非常感谢。