I have a pandas dataframe structured like this:
Name | Identifier | Tags_0_Value | Tags_1_Value | Tags_2_Value | Tags_3_Value | Tags_4_Value | Tags_5_Value | Tags_6_Value |
---|---|---|---|---|---|---|---|---|
Bottle Nose Well | 1345 | A- Groundwater Aquifer | WL - Water Level Network | 104 - Area Wide Map | 110 - Area Network | 114 - Area Wide Monitoring | ||
BMOs Adventure | 3745 | A - Groundwater Aquifer | HR - Domestic Wells | 15 - Baylor County Well Survey | 20- Data collection | 3 - Water Level Measurable | 6 - Onsite | 9 - Water Quality |
but I want to collapse the columns starting with "Tags" into a single column and append every value to a row indexed by the Name/Identifier, like this:
Name | Identifier | Tags |
---|---|---|
Bottle Nose Well | 1345 | A- Groundwater Aquifer |
Bottle Nose Well | 1345 | WL - Water Level Network |
Bottle Nose Well | 1345 | 104 - Area Wide Map |
Bottle Nose Well | 1345 | 110 - Area Network |
Bottle Nose Well | 1345 | 114 - Area Wide Monitoring |
BMOs Adventure | 3745 | A - Groundwater Aquifer |
BMOs Adventure | 3745 | HR - Domestic Wells |
BMOs Adventure | 3745 | 15 - Baylor County Well Survey |
BMOs Adventure | 3745 | 20- Data collection |
BMOs Adventure | 3745 | 3 - Water Level Measurable |
BMOs Adventure | 3745 | 6 - Onsite |
BMOs Adventure | 3745 | 9 - Water Quality |
I've tried the transpose and pivot functions in Pandas, but already know that's not I need.