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: 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 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> 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: 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 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: 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 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