我正在嘗試查找所有可能的速率組合的「Measured_Power」的最小值,最大值和平均值。我有很多費率和頻率(10個費率,10個頻率)。我的CSV文件看起來像:在python中查找csv文件中的最小,最大值
Channel, Rate, Length, Frequency, Expected_Power, Measured_Power, Expected_Eq, Measured_Eq,
A, 27, 1000, 100, 20, 20.16, <-23.0, -27.33,
A, 6, 1000, 100, 20, 20.12, <-23.0, -25.96,
A, 3, 1000, 100, 20, 20.05, <-23.0, -26.34,
A, 27, 1000, 101, 20, 20.11, <-23.0, -24.88,
A, 6, 1000, 101, 20, 20.26, <-23.0, -25.55,
A, 3, 1000, 101, 20, 20.08, <-23.0, -25.42,
B, 27, 1000, 100, 20, 20.5, <-23.0, -26.98,
B, 6, 1000, 100, 20, 20.21, <-23.0, -24.61,
B, 3, 1000, 100, 20, 20.17, <-23.0, -23.54,
...
我已經試過:
import numpy
file = r'C:\data.csv'
c = numpy.genfromtxt(file,dtype='float',delimiter = ',',skiprows=1, skip_header=0, skip_footer=0, usecols=5,usemask=True)
print c.max()
print c.min()
我能找到的最大和最小,但我如何通過特定通道,速率和頻率排序呢?任何幫助將不勝感激。 預計出於對Measured_Power:
Chanel, Rate, Max, Min, Average,
A, 3, .., .., ..,
A, 6, .., .., ..,
., ., .., .., ..,
., ., .., .., ..,
., ., .., .., ..,
A, 27,.., .., ..,
B, 3, .., .., ..,
B, 6, .., .., ..,
., ., .., .., ..,
., ., .., .., ..,
., ., .., .., ..,
B, 27,.., .., ..,
這並不明顯,你想要什麼,你有什麼,以及你期望如何達到你的目標。請**舉例輸入和輸出**需要和*解釋*你一直在試圖做到這一點。 – Veedrac 2014-10-07 13:59:32
你是否喜歡'numpy'?這聽起來更像是一個['pandas'](http://pandas.pydata.org)問題。 – DSM 2014-10-07 14:09:56
我正在尋找簡單的解決方案(numpy,熊貓等..) – dmaster 2014-10-07 14:15:08