gpt4 book ai didi

python - 值错误: Location based indexing can only have [labels (MUST BE IN THE INDEX)

转载 作者:太空宇宙 更新时间:2023-11-03 21:44:58 24 4
gpt4 key购买 nike

我正在尝试使用以下方法从一个数据帧中删除另一个数据帧中的重复项:

frame = frame.loc[frame.index.difference(properties.index), ]

但我收到此错误:

ValueError: Location based indexing can only have [labels (MUST BE IN THE INDEX), slices of labels (BOTH endpoints included! Can be slices of integers if the index is integers), listlike of labels, boolean] types

这是frame.index:

>>> frame.index
Index([ u'(11) 4451-5818', u'(11) 96949-2162', u'(11) 5536-5052',
u'(11) 5084-1481', u'(11) 3846-6720', u'(11) 3067-4424',
u'(11) 3256-5330', u'(11) 5181-4004', u'(11) 3078-0760',
u'(11) 3152-6111',
...
u'(11) 2541-7538', u'(11) 2057-7777', u'(11) 3283-0473',
u'(11) 2231-3614', u'(11) 5615-6101', u'(11) 2242-4927',
u'(11) 2849-7040', u'(11) 2456-4342', u'(11) 2541-0284',
u'(11) 3051-5881'],
dtype='object', name=u'phone', length=18039)

>>> properties.index
Index([u'(01) 13562-7550', u'(11) 5051-1959', u'(11) 3052-1878',
u'(11) 3849-5839', u'(11) 3203-0996', u'(11) 3258-2578',
u'(11) 3051-4545', u'(11) 5542-1680', u'(11) 3159-8889',
u'(11) 3283-2349',
...
u'(11) 2305-2200', u'(18) 997389999', u'(11) 3868-4884',
u'(11) 3259-0932', u'(11) 3081-2158', u'(11) 3034-6500',
u'(11) 5082-4308', u'(11) 34346467', u'', u'(11) 31923858'],
dtype='object', name=u'phone', length=1279)

我该如何解决这个问题?

最佳答案

我从框架中删除了重复项和空值,它现在正在工作

关于python - 值错误: Location based indexing can only have [labels (MUST BE IN THE INDEX),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52570860/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com