[已解决]Series object has no attribute explode

时间:2022-07-25
本文章向大家介绍[已解决]Series object has no attribute explode,主要内容包括其使用实例、应用技巧、基本知识点总结和需要注意事项,具有一定的参考价值,需要的朋友可以参考一下。

报错代码

s = pd.Series([[1, 2, 3], 'foo', [], [3, 4]])
s

0 [1, 2, 3] 1 foo 2 [] 3 [3, 4] dtype: object

s.explode()

AttributeError: 'Series' object has no attribute 'explode'

解决: 升级pandas至0.25以及以上版本