I'm trying to get columns in my data set from rows. Here is my present DataFrame:
What I want to achieve, is convert the following rows from column of index 0:
title:, category:, ..., href:
into columns without duplicates (there would be 7 columns) and match the corresponding rows from column of index 1 to them.
I've tried to transpose this dataframe, but i didn't know how to reduce amount of columns.
Code:
df = pd.DataFrame(data=items)
df_2 = df.transpose()
Output:
What I've also tried:
pd.set_index(), pd.groupby(), pd.reset_index()
but it didn't work either.
Thank you so much for Your help. Have a nice day!