df = pd.DataFrame()
df['col1'] = ('y','y','y')
df['col2'] = ('a','b','c')
df['col3'] = ('x','x','x')
print df
I have this df and am trying to copy or move the b,c to new columns in row one.
I've tried pivot_table, pd.groupby, and for index, row in top.iterrows():
But there may not always be three rows in the df. So if there aren't any rows then don't do anything.
This has been my last attempt. I don't remember exactly what I tried with .groupby or pivot_table
for index, row in df.iterrows():
df1['col2'+row] = df1['col2'][row]
top_comb = top_comb.append(top)
Col1 | Col2 | Col3 | Col21 | Col22
y | a | x | b | c