I have a data frame (df1) as shown below. The elements in the 1st column start repeating after a certain number but the corresponding 2nd column elements are unique
0 1
0 A Ok
1 B 1234
2 C True
3 D Yes
4 A Ok
5 B 6789
6 C False
7 D No
I have created a new DataFrame(df2) with column names as the elements in the 1st column of df1 without repetition
column_names = df1[0].drop_duplicates()
df2 = pd.DataFrame(columns=column_names)
I want to copy the elements in the 2nd column of df1 under the column names in df2 as shown
A B C D
0 Ok 1234 True Yes
1 Ok 6789 False Yes
2 Ok 1567 False N/A
Can anyone help me with this?