Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/290.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 如何处理错误:ValueError:无法从Pandas.Series.explode()的重复轴重新索引_Python_Pandas_Dataframe_Data Manipulation_Data Wrangling - Fatal编程技术网

Python 如何处理错误:ValueError:无法从Pandas.Series.explode()的重复轴重新索引

Python 如何处理错误:ValueError:无法从Pandas.Series.explode()的重复轴重新索引,python,pandas,dataframe,data-manipulation,data-wrangling,Python,Pandas,Dataframe,Data Manipulation,Data Wrangling,我有一个非常大的数据集,大约有40万行 这种性质的东西,这不是完整的数据集。我附上了一个大数据集的简短样本 d=pd.DataFrame({'age':{0:66.0, 1: 66.0, 2: 66.0, 3: 66.0, 4: 66.0, 5: 66.0, 6: 66.0, 7: 66.0, 8: 66.0, 9: 66.0}, '值':{0:3000.0, 1: 3000.0, 2: 6000.0, 3: 6000.0, 4: 3000.0, 5: 3000.0, 6: 4500.0, 7:

我有一个非常大的
数据集
,大约有40万行

这种性质的东西,这不是完整的数据集。我附上了一个大数据集的简短样本

d=pd.DataFrame({'age':{0:66.0,
1: 66.0,
2: 66.0,
3: 66.0,
4: 66.0,
5: 66.0,
6: 66.0,
7: 66.0,
8: 66.0,
9: 66.0},
'值':{0:3000.0,
1: 3000.0,
2: 6000.0,
3: 6000.0,
4: 3000.0,
5: 3000.0,
6: 4500.0,
7: 4500.0,
8: 4500.0,
9: 1900.0},
'start':{0:'158017200',
1: '1583017200',
2: '1583017200',
3: '1583017200',
4: '1583017200',
5: '1583017200',
6: '1583017200',
7: '1583017200',
8: '1583017200',
9: '1583017200'},
'end':{0:'1583103600',
1: '1583103600',
2: '1583103600',
3: '1583103600',
4: '1583103600',
5: '1583103600',
6: '1583103600',
7: '1583103600',
8: '1583103600',
9: '1583103600'},
'方向':{0:2.0,
1: 2.0,
2: 2.0,
3: 2.0,
4: 2.0,
5: 2.0,
6: 2.0,
7: 2.0,
8: 2.0,
9: 2.0},
'productA':{0:['3'],
1: ['3'],
2: ['3', '4'],
3: ['3', '4'],
4: ['3', '4'],
5: ['3', '4'],
6: ['3', '4', '6', '2', '5', '1'],
7: ['3', '4', '6', '2', '5', '1'],
8: ['3', '4', '6'],
9: ['3', '4']}})
我试图从完整的数据集中分解
productA

df_trav.productA=df_trav.product_subtypes.explode()
我得到以下错误:

ValueError: cannot reindex from a duplicate axis

请问我如何处理这种错误?

我想你的意思是
df\u trav=df\u trav.explode('product\u subtypes')
谢谢!它起作用了