I have a list of dictionaries which has been converted into a dataframe using json_normalize.
Dataset:
x = [{
"_id" : 71,
"Ids" : [
"10",
"59"
],
"roles" : [
"janitor", "mechanic", "technician"
]
}]
Dataframe:
_id Ids roles
71 [10, 59] [janitor, mechanic, technician]
What I am trying to do is find a way to dynamically explode all the list columns/keys (Ids and roles) without explicitly typing the column names. Is this possible?
Desired Output:
_id Ids roles
71 10 janitor
71 10 mechanic
71 10 technician
71 59 janitor
71 59 mechanic
71 59 technician
Any assistance would be appreciated.