I'm new to python so this might seem a bit easy problem for you expertise.
I've 6 categories(0 to 5),each of which has 4 sub-categories namely: '3','4','5','6'.
for this,I've created a dataframe using:
df=pd.DataFrame(index=list(range(5)),columns=list([3,4,5,6])
Now,I'm getting some calculated values from my loop:
for i in range(5):
for j in list([3,4,5,6]):
somecalculation=a
Now,I'm trying to replace the values of df with these calculations
like for second iteration (i.e. for i=0,j=4), I got somecalculation=b, for third somecalculation=c and further d.
When loop again iterates over i=2,I get calculations as e,f,g,h and so on for further iterations.
I'm trying to append these values to df as soon as I obtain them but I'm not getting the desired output as
3 4 5 6
0 a b c d
1 e f g h
2 i j k l
.........
.........
.........
because ultimately,I want to take average of the column values using their indices, but replacing values of dataframe is becoming troublesome.