CSV to matrix array
Ana Dionísio
anadionisio257 at gmail.com
Fri Apr 12 10:22:01 EDT 2013
Hello!
I have a CSV file with 20 rows and 12 columns and I need to store it as a matrix. I already created an array with zeros, but I don't know how to fill it with the data from the csv file. I have this script:
import numpy
from numpy import array
from array import *
import csv
input = open('Cenarios.csv','r')
cenario = csv.reader(input)
array=numpy.zeros([20, 12])
I know I have to use for loops but I don't know how to use it to put the data the way I want. Can you help me?
Thanks!
More information about the Python-list
mailing list