0

I'm trying to move one column to another df as a new column using an index containing similar values. Before clearing duplicates the df 'players' had 425 rows (401 after) and the 'fppm' df had 532 rows (525 after).
I'm still getting the ValueError listed below saying I cannot reindex from a duplicate axis and have no clue where to go from here. Any help is appreciated!!

I've tried deleting duplicates from both dfs to no avail. Don't know where to go from here.


fppm = pd.read_csv('FD Fppm.csv', index_col=0)
players = pd.read_csv('Fanduel NBA Players - 10232019.csv', index_col=0)

players[players.duplicated()]

players = players.drop_duplicates()
fppm = fppm.drop_duplicates()


players['fppm'] = fppm['FD Fppm']

"ValueError: cannot reindex from a duplicate axis"

Moon
  • 4,014
  • 3
  • 30
  • 66
PatrickAllen
  • 13
  • 1
  • 4
  • 1
    Please read the following documentation: https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.DataFrame.join.html – Aryerez Oct 23 '19 at 10:13
  • 1
    I guess you need [merge](https://stackoverflow.com/questions/53645882/pandas-merging-101) – jezrael Oct 23 '19 at 10:26
  • Join ended up working great @Aryerez! I did have to take out the index_col parameter when I read in the csvs and just set the index as parameters for join. – PatrickAllen Oct 23 '19 at 16:46

0 Answers0