I am trying to make new columns in a dataframe based on how many times a new value gets paired with another column.
original dataframe:
Name | Primary Address | Alternative Address |
---|---|---|
John Doe | 123 Fudge Rd. | UHP.INC |
Lee Smith | Pro Sports,LLC | |
Hank Hill | Pharm Tank.co | PodRacing.Cool |
Hank Hill | GhoulSchool,343 | |
Hank Hill | MoneyTree Rd. |
Dataframe Im trying to achieve where if there is multiple alternative addresses to one name they split out to as many columns as needed:
Name | Primary Address | Alternative Address | Alternative Address_2 | Alternative Address_3 |
---|---|---|---|---|
John Doe | 123 Fudge Rd. | UHP.INC | ||
Lee Smith | Pro Sports,LLC | |||
Hank Hill | Pharm Tank.co | PodRacing.Cool | GhoulSchool,343 | MoneyTree Rd. |