Python pandas.Series.explode属性错误
我正试着使用 因为我对爆炸整个数据帧不感兴趣。 我试图分解的dataframe列看起来像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(),它抛出了
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
。请编辑您的问题并将这些信息添加到您的问题中好吗?非常感谢。