CSV to matrix array

Mark Lawrence breamoreboy at yahoo.co.uk
Sat Apr 13 12:52:23 EDT 2013


On 13/04/2013 16:30, Ana Dionísio wrote:
> It's still not working. I still have one column with all the data inside, like this:
>
> 2999;T3;3;1;1;Off;ON;OFF;ON;ON;ON;ON;Night;;;;;;
>
> How can I split this data in a way that if I want to print "T3" I would just do "print array[0][1]"?
>

I said before I'm no expert on numpy but my understanding is that all 
arrays are homogeneous, hence you can't load the data you show above 
without some form of mapping.  In that case you'd have to read the data 
with the csv module as others have already suggested, apply your mapping 
and then write this to your array.  The obvious alternative is to use a 
list of lists.

-- 
If you're using GoogleCrap™ please read this 
http://wiki.python.org/moin/GoogleGroupsPython.

Mark Lawrence




More information about the Python-list mailing list