小编hen*_*axe的帖子

唯一索引抛出:重新索引仅对具有唯一值的索引对象有效

所以我有一个数据帧列表。当尝试附加它们时,我得到:

pandas.errors.InvalidIndexError: Reindexing only valid
with uniquely valued Index objects
Run Code Online (Sandbox Code Playgroud)

但是,我的索引是唯一的,例如:

dfList[0].index
Index(['5560654070'], dtype='object')

fList[1].index
Index(['5562221068'], dtype='object')
Run Code Online (Sandbox Code Playgroud)

append()、 或 时concat(),都会给出上述错误。

dfList[0].append(dfList[1])

"""
pandas.errors.InvalidIndexError: Reindexing only valid with uniquely valued Index objects
"""
Run Code Online (Sandbox Code Playgroud)

reset_index()也尝试过ignore_index=True,但似乎没有任何效果。

python-3.x pandas

10
推荐指数
1
解决办法
3万
查看次数

标签 统计

pandas ×1

python-3.x ×1