Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #43524

Re: CSV to matrix array

From Mark Lawrence <breamoreboy@yahoo.co.uk>
Subject Re: CSV to matrix array
Date 2013-04-13 17:52 +0100
References <2506a155-40b6-4040-bc12-a08ce0d79cd7@googlegroups.com> <87li8m7hyk.fsf@pascolo.net> <fe492580-d59d-4862-a586-407ad9759174@googlegroups.com>
Newsgroups comp.lang.python
Message-ID <mailman.557.1365871903.3114.python-list@python.org> (permalink)

Show all headers | View raw


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

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

CSV to matrix array Ana Dionísio <anadionisio257@gmail.com> - 2013-04-12 07:22 -0700
  Re: CSV to matrix array Mark Lawrence <breamoreboy@yahoo.co.uk> - 2013-04-12 16:25 +0100
    Re: CSV to matrix array Ana Dionísio <anadionisio257@gmail.com> - 2013-04-12 10:12 -0700
      Re: CSV to matrix array rusi <rustompmody@gmail.com> - 2013-04-12 10:34 -0700
    Re: CSV to matrix array Ana Dionísio <anadionisio257@gmail.com> - 2013-04-12 10:12 -0700
  Re: CSV to matrix array Miki Tebeka <miki.tebeka@gmail.com> - 2013-04-12 16:10 -0700
  Re: CSV to matrix array giacomo boffi <pecore@pascolo.net> - 2013-04-13 14:06 +0200
    Re: CSV to matrix array Ana Dionísio <anadionisio257@gmail.com> - 2013-04-13 08:30 -0700
      Re: CSV to matrix array Mark Lawrence <breamoreboy@yahoo.co.uk> - 2013-04-13 17:52 +0100
      Re: CSV to matrix array Oscar Benjamin <oscar.j.benjamin@gmail.com> - 2013-04-13 20:01 +0100

csiph-web