我有以下數據Python每隔n行排序一次數據?
# Data set number 1
#
# Number of lines 4081
#
# Max number of column 3 is 5
# Blahblah
# The explanation about each rows
3842 1 1 3843 0 0.873 0.922 0.000 0.317
3843 2 2 3842 3844 0 0.873 0.873 1.747 2.000 -0.614
3844 1 1 3843 0 0.873 0.922 0.000 0.312
......
2191 3 2 2117 2120 0 0.925 0.934 1.878 2.000 -0.750
# Data set number 2
#
# Number of lines 4081
#
# Max number of column 3 is 5
# Blahblah
# The explanation about each rows
3842 1 1 3843 0 0.873 0.922 0.000 0.317
3843 2 2 3842 3844 0 0.873 0.873 1.747 2.000 -0.614
我的數據具有2010的數據集的重複格式,它由7個標題行+ 4081條數據線。如何對數據行進行排序,而不是整個數據行,但是在重複數據集內?所以,我希望對每個數據集的每個8〜4081行進行排序。
ps)我希望排序數據w.r.t第一列,我的意思是按列排序。因此,數據的第一列,應責令等欄目遵循
謝謝。我有額外的問題。我如何閱讀每個數據庫的每一列和每行?另外,我怎樣才能從這些數據中只讀整數?我希望爲每個數據塊的每行每列索引每個數據塊,只使用整數 – exsonic01 2014-10-03 18:10:19
我試圖使用類似於「column1 = lines.split()[0]」的命令,但它表示列表對象沒有屬性拆分。但是像「print lines [0] .split()[3]」這樣的命令可以工作。我無法理解。 – exsonic01 2014-10-03 18:51:56