ValueError: cannot reindex from a duplicate axis using isin with pandas

前端 未结 1 1512
花落未央
花落未央 2021-01-13 15:18

I am trying to short zipcodes into various files but I keep getting

ValueError: cannot reindex from a duplicate axis

I\'ve read

1条回答
  •  醉梦人生
    2021-01-13 15:47

    I'm pretty sure your problem is related to your mask

    df = df[['VIN', 'Reg Name', 'Reg Address', 'Reg City', 'Reg ST', 'ZIP',
             'ZIP', 'Catagory', 'Phone', 'First Name', 'Last Name', 'Reg NFS',
             'MGVW', 'Make', 'Veh Model','E Mfr', 'Engine Model', 'CY2010',
             'CY2011', 'CY2012', 'CY2013', 'CY2014', 'CY2015', 'Std Cnt', 
            ]]
    

    'ZIP' is in there twice. Removing one of them should solve the problem.

    The error ValueError: cannot reindex from a duplicate axis is one of these very very cryptic pandas errors which simply does not tell you what the error is.

    The error is often related to two columns being named the same either before or after (internally in) the operation.

    0 讨论(0)
提交回复
热议问题