Hello!  I'm reading a text file with two numbers in str format on each line.  
The numbers are converted into integers.  Each integer is then assigned to a 
2-dimensional array ij (see code below).  The problem is that neither of the 
array assignments work ie. both ij[index, 0] = r and ij[index, 1] = c are 
always 0 (zero).  I've checked r and c and both are integers (>=0).  

import sys
import os
import numpy

nnz = 1200000
ij = numpy.array(numpy.empty((nnz, 2), dtype=int))
index = 0
filename = 'test_ij.txt'
for line in open(filename, 'r'):
    line = line.rstrip('\n')
    r, c = map(str, line.split(','))
    r = int(r)
    c = int(c)
    ij[index, 0] = r
    ij[index, 1] = c
    index = index + 1

What am I doing wrong?

Dinesh
_______________________________________________
Numpy-discussion mailing list
Numpy-discussion@scipy.org
http://projects.scipy.org/mailman/listinfo/numpy-discussion

Reply via email to