pandas - Saving a matrix in the text by using different spacing in the columns -
i have tow matrix 1 show data , matix show information data. matrix data:
10 0 1 2 3 4 5 0 1979001 0.439353 0.255700 0.270974 0.346030 0.239454 0.229373 1 1979002 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 2 1979003 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 3 1979004 0.109838 0.063925 0.067743 0.086508 0.059863 0.057343 4 1979005 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 5 1979006 5.609492 4.596672 4.773364 5.357853 4.617296 4.391231 6 1979007 1.311139 1.003951 1.077528 1.384126 0.991775 0.921057 7 1979008 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 8 1979009 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 9 1979010 0.140775 0.158411 0.140194 0.107244 0.133659 0.167177 10 1979011 1.029793 1.311986 1.289152 1.057077 1.381493 1.350875 11 1979012 2.229281 1.592264 1.786475 2.479978 1.640830 1.411289 12 1979013 2.094382 1.370128 1.531622 2.126227 1.384526 1.200632 13 1979014 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 14 1979015 0.439353 0.255700 0.270974 0.346030 0.239454 0.229373
and matrix information in blow: enter image description here
0 1 2 3 4 5
station sub1 sub2 sub3 sub4 sub5 sub6
lati 2 5.3 4.6 3 5 6
long 0.2 0.2 0.3 0.8 0.7 0.6
elev 1000 1000 1000 1000 1000 1000
i want tow matrix (sown above) save 1 text file following format, first column of first row in text (that is, matrix of information) spaced other columns, , first row after columns separated (,) . want write data matrix without patch (in form of sample) under information matrix. tried different codes , using .csv_to , mode (a), unfortunately did not.please me. thanks
text file sample
station 1,2,3,4,5 lati 36.8 36.8 36.7 36.7 36.7 long 45.7 45.6 45.6 45.6 45.6 elev 1000 1000 1000 1000 1000 1979001000.0000.1000.1000.0-99.0 1979002000.7000.6000.3000.2000.0 1979003000.0000.0-99.0000.0000.0 1979004005.3011.0015.0015.8016.9 1979005000.2001.2002.3002.7003.0
-99.0 , 000.1 2 of above text files
Comments
Post a Comment