0

So I have two data frames (df1):

Zip Counts
11232   5
11220   19
10009   11
11215   9

And another(df2):

borough neighborhood    zip code    sale price  sale date   sale per sq feet
1   ALPHABET CITY   10009   7738700 12/22/2016               3758.47
1   ALPHABET CITY   10009   3750000 4/3/2017                 2142.86
1   ALPHABET CITY   10009   5235000 7/11/2017                1975.47

How could I add an additional column to df2 to include the counts from the df1 and apply it to each row that has a corresponding zip code

I would like the new data frame to look like:

    borough neighborhood    zip code    sale price  sale date   sale per sq feet    count
0   1       ALPHABET CITY   10009       7738700     12/22/2016  3758.47              11
1   1       ALPHABET CITY   10009       3750000     4/3/2017    2142.86              11
2   1       ALPHABET CITY   10009       5235000     7/11/2017   1975.47              11

What's the best method of combining these?

martineau
  • 119,623
  • 25
  • 170
  • 301

0 Answers0