0

I am trying to replace the Values in the "All Assortment" column of the "buyer" data frame.

Values to Be replaced

I need to replace them with the data from the "All Stores" column of the "asl" data frame. The twist is that the index values of the asl data frame are the values that need to match for the replacement to work.

Use Index to move stores to other dataframe

Ty Swenson
  • 49
  • 8
  • 3
    Please note that [ask] specifically says not to use screenshots of data. Please also create a reproducible dataframe. See [reproducible pandas examples](https://stackoverflow.com/questions/20109391/how-to-make-good-reproducible-pandas-examples). – BigBen Apr 05 '22 at 13:44

1 Answers1

0

Hard to say without a minimal reproducible example, but try mapping the values of buyer['All Assortment'] to corresponding values from the asl['All Stores'] column based on the asl index:

buyer['All Assortment'] = buyer['All Assortment'].map(asl['All Stores'])
Peter Leimbigler
  • 10,775
  • 1
  • 23
  • 37