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]
这对我的要求有意义吗?有没有办法做到这一点?