Quantcast
Channel: Data Science, Analytics and Big Data discussions - Latest topics
Viewing all articles
Browse latest Browse all 4448

Python error: "cannot reindex from a duplicate axis"

$
0
0

@Aarshay wrote:

Hello,

I'm facing a problem in python wherein I'm getting the error "cannot reindex from a duplicate axis".

I have 2 data sets which I have concatenated into 1 using:
data = pd.concat([data_train,data_test])

Now I'm trying to access specific part of the combined dataframe using:
data.loc[i,"Col 1"] = x

This statement results in error. However I don't get an error when I use:
data[i,"Col 1"] = x

The python documentation (http://pandas.pydata.org/pandas-docs/stable/indexing.html) suggests that the second option is not recommended and may not yield correct result.

Please help me figure out where I'm going wrong.

Thanks,
Aarshay

`

Posts: 3

Participants: 2

Read full topic


Viewing all articles
Browse latest Browse all 4448

Trending Articles