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.