【发布时间】:2014-06-24 17:36:28
【问题描述】:
有没有办法在 python 上创建某种数组 为文件中的每一行分配一个 x 和 y 值 每次都分裂?
myArray=[][]?
说线条是
0.0 0.0 NaN ( I want this line to have value[1,1]
1.0 0.0 1.0 (and so increasing y by one leaving x alone [1,2]
2.0 0.0 NaN ---[1,3]
3.0 0.0 NaN---[1,4]
0.0 1.0 2.0---(but when the middle term changes value (increase x by 1 and reset y to 1 leaving [2,1])
1.0 1.0 3.0---[2,2]
2.0 1.0 4.0---[2,3]
3.0 1.0 NaN--- and so on
0.0 2.0 5.0
1.0 2.0 6.0
2.0 2.0 7.0
3.0 2.0 NaN
0.0 3.0 NaN
1.0 3.0 NaN
2.0 3.0 8.0
3.0 3.0 9.0
0.0 4.0 NaN
1.0 4.0 NaN
2.0 4.0 NaN
3.0 4.0 10.0 ---[4,4]
这对我的要求有意义吗? 有没有办法做到这一点?
【问题讨论】:
-
(number of 0.0 in column 1, count of rows after the last 0.0 in column 1)?
标签: python arrays storing-data