0

I have a pandas dataframe called females:

      iid    id  gender  idg  condtn  wave  round  position  positin1  order  \
0       1   1.0       0    1       1     1     10         7       NaN      4   
1       1   1.0       0    1       1     1     10         7       NaN      3   

and so on. each iid has around ten rows and in total there are around 3500 rows.

I also have a dataframe:

females_scores = pd.DataFrame(columns=['iid', 'Number Matches', 'Number Decisions', 'Match Rate', ' Decision Rate'])

which has data on each iid.

My question: What is the best way to add a column in the first dataframe (females) that maps the "Number Decisions" in the second dataframe according to iid, to every row in the first dataframe?

I was thinking of using np.where, but this would return an array? Im not sure what the best path is tbh thanks in advance!

entercaspa
  • 594
  • 6
  • 17
  • 3
    pandas support sql type joins, ie, joining 2 tables based on a common key. Read this page to understand how that works - http://pandas.pydata.org/pandas-docs/stable/merging.html – TrigonaMinima Apr 11 '17 at 16:23
  • Possible duplicate of [Pandas Combining 2 Data Frames (join on a common column)](http://stackoverflow.com/questions/18792918/pandas-combining-2-data-frames-join-on-a-common-column) – Jan Trienes Apr 11 '17 at 16:23

0 Answers0