Here's the thing,
I need to pivot a table that is in the long format to its wide format.
Example:
d = {'col1': ['a','b', 'c', 'b', 'c', 'c'], 'col2': ['joe', 'mary', 'mary', 'joseph', 'allan', 'mary'],
'col3':[2020, 2022, 2019, 2020, 2022, 2019], 'values':[123,235,3456,213,423,52]}
df = pd.DataFrame(data=d)
print(df)
I would need something like
df = df.pivot(index=["col1"], columns=["col3", "col2"], values="values")
For generating this structure with values if exists and null if doesnt:
col1;2019_joe;2019_joe;2019_joe;2019_mary;2020_mary;2021_mary
a
b
c
d
e
f
But the command pivot() doesnt accept a list on column keyword argument.