I have the following df:
import pandas as pd
data = pd.DataFrame(
{'IP_ADDR':['1.1.1.1','1.1.1.2','1.1.1.1','1.1.1.2','1.1.1.3'],
'Vlan':['TEst', 'Prod', 'Win', 'Linux', 'AIX'],}
)
print(data)
IP_ADDR Vlan
0 1.1.1.1 TEst
1 1.1.1.2 Prod
2 1.1.1.1 Win
3 1.1.1.2 Linux
4 1.1.1.3 AIX
I'm trying to find for each IP addr in column IP_ADDR the matching vlan in the Vlan column. (if the same ip is found more than once in column IP_ADDR then add the new value from column VLan to the existing values for that ip) The expected output should be:
IP_ADDR Vlan
0 1.1.1.1 TEst,Win
1 1.1.1.2 Prod, Linux
2 1.1.1.3 AIX
Any ideas guys? Thank you!