samedi 1 août 2015

Min/Max, Mean and Median of columns

I have a complex task and I am struck with it. Below is the sample of the data that i have in a text file. I have to calculate min/max, mean and median of each column. There are over 1000 rows and 50-100 columns in each row. Some columns only contain special characters '?', we don't have to calculate any value for them, just output zero for those columns in the end result. And we have to output a. min/max b. mean (mean = (sum of available values) / number of available values) c. median of every column into another txt file in a single row(output below).

7.84626,0.00121498,?,?,?,?,0.595974,1722821,40877036,73,601,130,45,73,1481,1479,2153,4922.35,116792,6.13849,7.86395,0.00847591,0.00737798 6.18782,0.000136137,?,?,?,?,0.595974,1722821,40877036,73,601,130,45,73,1481,1479,2153,4922.35,116792,6.13849,7.86395,0.00847591 7.86844,0.00187588,?,?,?,?,0.595974,1722821,40877036,73,601,130,45,73,1481,1479,2153,4922.35,116792,6.13849,7.86395,0.00847591,0.00737798 6.12701,0.0010252,?,?,?,?,0.595974,1722821,40877036,73,601,130,45,73,1481,1479,2153,4922.35,116792,6.13849,7.86395,0.00847591,0.00737798

can someone help me with this task?

Output: c1, c2, c3, c4, c5, c6, c7, c8,c9,c10,c11.....c(n) min - - - - - - - - - - - max - - - - - - - - - - - mean - - - - - - - - - - - median - - - - - - - - - - -

Aucun commentaire:

Enregistrer un commentaire