0
Bad design has left me with database fields that can be populated with comma separated list
Assume my database has the following columns
- ID
- DESCRIPTION
- USERS
- LOCATIONS
I know that ID and DESCRIPTION are always relevant.
USERS and LOCATIONS can contain 0, 1, or more strings separated by a comma
ASSUME if ID=1, DESCRIPTION=BASIC, USERS=MANNY,MO,JACK,HAMBURGLAR LOCATIONS=PEPBOYS,MCDONALDS
I would like the processed table to yield:
1 BASIC MANNY ‘PEPBOYS,MCDONALDS’
1 BASIC MO ‘PEPBOYS,MCDONALDS’
1 BASIC JACK ‘PEPBOYS,MCDONALDS’
1 BASIC HAMBURGLAR ‘PEPBOYS,MCDONALDS’
1 BASIC ‘MANNY,MO,JACK,HAMBURGLAR’ PEPBOYS
1 BASIC ‘MANNY,MO,JACK,HAMBURGLAR’ MCDONALDS
the pandas module included in the python environment pre-dates DataFrame.explode() capabilities.
any elegant suggestions?
3 replies
-
Add a new Python environment and use the Pandas module that you want.