I'm trying to transpose df into df_spread.
import pandas
df = {"Type": ("A", "B", "B", "C","D"),
"Amount":(220, 68, 1400, 120, 99)
}
df = pandas.DataFrame(df)
The output I want would be like this:
df_spread = {"A": 220, "B": 68, "B": 1400, "C": 120, "D": 99
}
df_spread = pandas.DataFrame(df_spread)
I know that a wide dataframe like this isn't the best practice, but I'm going to concatenate df with a bunch of other dataframes.