0

I have the following data frame:

IP      target
101     1
101     1
102     0
103     1
41      0
47      0
47      1
47      1

I want to get the following dataframe where IP_Cnt is the count of times the IP has a target of 1. How can i do this in pandaas? Expected Output:

IP     IP_cnt     target
101    2          1
101    2          1
102    0          0
103    1          1
41     0          0
47     2          0
47     2          1
47     2          1
Eisen
  • 1,697
  • 9
  • 27

0 Answers0