This is my initial dataframe dfA :
| idA | data |
|---|---|
| 1 | row |
| 2 | data |
| 3 | data |
dataframe dfB
| idC | idA |
|---|---|
| 1 | 1 |
| 2 | 1 |
| 3 | 3 |
| 4 | 3 |
| 5 | 3 |
| 6 | 3 |
I am trying to count every id existence of dfA in dfB , and add to new column like this:
| idA | data | count |
|---|---|---|
| 1 | row | 2 |
| 2 | data | 0 |
| 3 | data | 4 |
how can i do this plz
https://stackoverflow.com/questions/67260701/pandas-new-column-counting-ids-existence-in-other-dataframe April 26, 2021 at 12:03PM
没有评论:
发表评论