pandas - exporting a list of lists to csv in python -
i want export list of lists csv file. however, csv file not showing of data.
initially have 30 rows of 'i' data , 1 row of 'r' data.
i run algorithm obtain peak areas when r plotted against i{i}. gives me 30 sets of data each 3 columns follows:
> 0 1 2 > 0 3053.6 105000.0 -5217775.735 > 1 3015.9 81892.0 -4013311.400 > 2 2962.8 98694.0 -2050799.050 > 3 2936.2 67884.0 -1140645.600 > 4 2906.3 2530000.0 -22099575.600 > 5 2871.5 102000.0 -653778.650 > 6 2777.9 8482.4 -68580.440 > 7 2719.3 11768.0 -91285.610 > 8 2625.0 5902.5 -40623.500 > 9 2599.3 5304.7 -69163.680 > 10 2573.5 18009.0 -170745.690 > 11 1538.0 12694.0 -965128.025 > 12 1467.7 9279.2 -144139.995 > 13 1451.4 21626.0 -280386.495 > 14 1329.8 7739.9 -63603.430 > 15 1173.9 8096.7 -66836.410 > 16 966.3 10964.0 -101197.010 > 17 799.2 32662.0 -305534.340 > 18 164.5 124000.0 -1579972.665
find_peaks function described above.
result =[] in range(1,31): result.append(pd.dataframe((find_peaks(df1['r'], df1['i {}'.format(i)])), index = none)) in range(1,31): df2 = pd.dataframe(result[i]) df2.to_csv('output.csv')
i'm not sure doing wrong.
you can try concat output dataframes one:
import pandas pd result = [] in range(1,31): result.append(pd.dataframe((find_peaks(df1['r'], df1['i {}'.format(i)])), index = none)) df2 = pd.concat(result) print df2.head() df2.to_csv('output.csv')
Comments
Post a Comment