I have a dataframe which has a structure like below.
id, name, value, employee_0_salary, employee_0_skills_0_id, employee_0_skills_1_id, employee_1_salary, employee_1_skills_0_id so on..
Basically formed from a flattened json. But the number of columns exceed 1024. I couldn’t copy the structure of json here but its a nested json with lists, arrays and dictionaries.
Now I want to split the dataframe so that the id column has duplicates but empoyee details comes as columns.
id salary skills_id
How to do it in pandas?
TIA
2
Answers
try this
maybe melt() does what you want?