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


Groups > comp.lang.python > #43524

Re: CSV to matrix array

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.freenet.ag!news2.euro.net!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <python-python-list@m.gmane.org>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.002
X-Spam-Evidence '*H*': 1.00; '*S*': 0.00; 'from:addr:yahoo.co.uk': 0.04; 'column': 0.07; 'arrays': 0.09; 'lawrence': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'array.': 0.16; 'csv': 0.16; 'numpy': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'subject:CSV': 0.16; 'subject:array': 0.16; 'suggested,': 0.16; 'wrote:': 0.18; 'module': 0.19; 'split': 0.19; 'working.': 0.19; 'print': 0.22; 'load': 0.23; 'header:User-Agent:1': 0.23; 'url:moin': 0.24; 'this:': 0.26; 'header:X-Complaints-To:1': 0.27; 'header:In-Reply- To:1': 0.27; "i'm": 0.30; 'url:wiki': 0.31; 'url:python': 0.33; "can't": 0.35; 'but': 0.35; 'url:org': 0.36; 'list': 0.37; 'lists.': 0.38; 'mapping': 0.38; 'to:addr:python-list': 0.38; 'to:addr:python.org': 0.39; 'received:org': 0.40; 'how': 0.40; 'skip:u 10': 0.60; 'read': 0.60; "you're": 0.61; 'show': 0.63; 'charset:windows-1252': 0.65; 'obvious': 0.74; 'ana': 0.84
X-Injected-Via-Gmane http://gmane.org/
To python-list@python.org
From Mark Lawrence <breamoreboy@yahoo.co.uk>
Subject Re: CSV to matrix array
Date Sat, 13 Apr 2013 17:52:23 +0100
References <2506a155-40b6-4040-bc12-a08ce0d79cd7@googlegroups.com> <87li8m7hyk.fsf@pascolo.net> <fe492580-d59d-4862-a586-407ad9759174@googlegroups.com>
Mime-Version 1.0
Content-Type text/plain; charset=windows-1252; format=flowed
Content-Transfer-Encoding 8bit
X-Gmane-NNTP-Posting-Host host-92-18-43-197.as13285.net
User-Agent Mozilla/5.0 (Windows NT 6.0; rv:17.0) Gecko/20130328 Thunderbird/17.0.5
In-Reply-To <fe492580-d59d-4862-a586-407ad9759174@googlegroups.com>
X-Antivirus avast! (VPS 130413-0, 13/04/2013), Outbound message
X-Antivirus-Status Clean
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.557.1365871903.3114.python-list@python.org> (permalink)
Lines 21
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1365871903 news.xs4all.nl 2621 [2001:888:2000:d::a6]:34781
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:43524

Show key headers only | 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