I have been working on a script, created a loop that takes gene_names as inputs, and the script runs analyses and stuff from data related to gene_name.
Currently I'm trying to export data obtained from said analyses to a .csv file, and I'm using pandas. It's doing what it should, except that I get my data in the row overwritten by the last gene_name that the script runs, e.g. gene_name1 is run and saved, but gene_name100 is run and is saved on the same row, overwriting it.
Values that I want saved are the gene_name(from somewhere up in the script), average_slope, t and p-val.
average_slope = np.array(correlation_per_donor.values()).mean()
                    t, p_val = ttest_1samp(correlation_per_donor.values(), 0)
                    print "Averaged slope across donors = %g (t=%g, p=%g)"%(average_slope, t, p_val)
                    print "Saving the slope, t- and p- values"
                    GeneName = [gene_name]
                    Slope = [average_slope]
                    t_value = [t]
                    p_value = [p_val]
                    alleninfDataSet = zip(GeneName,Slope,t_value,p_value)
                    dfalleninfDataSetprev = pd.DataFrame(data = alleninfDataSet, columns=['GeneName','Slope','t_value','p_value'])
                    dfalleninfDataSet = dfalleninfDataSetprev.append([dfalleninfDataSetprev])
                    dfalleninfDataSet.to_csv('Storage00.csv',index=True,header=True)
Would be grateful if someone has the solution to resolve this, i know it's simple but googling doesn't help much. Thanks!
