I have such dataframe:
import pandas as pd
data = [
[1, 'A', 10], [1, 'B', 20], [1, 'C', 30],
[2, 'A', 30], [2, 'B', 20], [2, 'C', 10],
[3, 'A', 20], [3, 'B', 40], [3, 'C', 20]
]
df = pd.DataFrame(data, columns = ['Day', 'Company', 'Profit'])
df
I would like to transform this table such that:
- each unique company name becomes a new column
- remaining data is grouped by day
How can I transform the data frame to the new data frame like this?