I am new to pandas, whenever I implement my code, first index is repeating for each row.
What I have tried is:
pg, ag, inc are arrays
cases=['a1','a2','a3']
data={'RED':rg,'GREEN':gg,'BLUE':bb}
stat_index=['HELO','HERE' ]
df=pd.DataFrame(data,pd.MultiIndex.from_product([cases,stat_index]),['RED','GREEN','BLUE'])
df.to_csv("OUT.CSV")
What I get is :
RED GREEN BLUE
a1 HELO 304.907 286.074 12.498
a1 HERE 508.670 509.784 94.550
a2 HELO 448.974 509.406 56.466
a2 HERE 764.727 432.084 43.462
a3 HELO 412.539 602.001 10.849
a3 HERE 321.9 603.888 78.847
What I actually want is:
RED GREEN BLUE
a1 HELO 304.907 286.074 12.498
HERE 508.670 509.784 94.550
a2 HELO 448.974 509.406 56.466
HERE 764.727 432.084 43.462
a3 HELO 412.539 602.001 10.849
HERE 321.9 603.888 78.847