Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #43476
| Path | csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed3.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <davea@davea.name> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.016 |
| X-Spam-Evidence | '*H*': 0.97; '*S*': 0.00; 'example:': 0.03; 'element': 0.07; 'puts': 0.07; 'csv': 0.16; 'mylist': 0.16; 'numpy': 0.16; 'received:74.208.4.195': 0.16; 'subject:CSV': 0.16; 'subject:array': 0.16; 'wrote:': 0.18; 'import': 0.22; 'separate': 0.22; 'print': 0.22; 'header:User-Agent:1': 0.23; 'header:In- Reply-To:1': 0.27; 'array': 0.29; 'file:': 0.31; 'position.': 0.33; 'could': 0.34; 'something': 0.35; 'convert': 0.35; 'really': 0.36; 'list': 0.37; 'to:addr:python-list': 0.38; 'pm,': 0.38; 'to:addr:python.org': 0.39; 'how': 0.40; 'details.': 0.61; 'pick': 0.64; 'received:74.208': 0.68; 'ana': 0.84; 'presumably': 0.84 |
| Date | Fri, 12 Apr 2013 13:46:22 -0400 |
| From | Dave Angel <davea@davea.name> |
| User-Agent | Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130308 Thunderbird/17.0.4 |
| MIME-Version | 1.0 |
| To | python-list@python.org |
| Subject | Re: CSV to matrix array |
| References | <2506a155-40b6-4040-bc12-a08ce0d79cd7@googlegroups.com> <mailman.530.1365787506.3114.python-list@python.org> <eed71ec6-589c-4b10-a617-a8f5145642a6@googlegroups.com> |
| In-Reply-To | <eed71ec6-589c-4b10-a617-a8f5145642a6@googlegroups.com> |
| Content-Type | text/plain; charset=ISO-8859-1; format=flowed |
| Content-Transfer-Encoding | 8bit |
| X-Provags-ID | V02:K0:KvOksZ09EKSBkxAdsYxvYp3LFaEXOLV0yaVBoa1B/1d LN3kpWVMasGxeYv5AdqEEZJO+OlI3uB5vPLxD0gPpGws/odRDT vaVY43NEGmyOE3Wfb3hxP1zqa9v0Qy/qfYZpYUjcyhXI6kyrF/ OFSSq6Ivcu1p1zLer1lS+DW/5J+ommd6BmLy6n8/hvTXEKlCvG gxR7yo5/U3eyWlJeezgGhh4uNhl9eKKFq0si1+F5uBT5pjd+Ek TB/M8GWA+CZAZjMHZ+9gqQVIG5clpZtMZKWnlutWjvfy0/s4lW S1Lr7JGBaBS237oNqxyqqV65HjwcnLwDwOewFdoTiwpNekQgw= = |
| 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.532.1365788811.3114.python-list@python.org> (permalink) |
| Lines | 28 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1365788811 news.xs4all.nl 2678 [2001:888:2000:d::a6]:40569 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:43476 |
Show key headers only | View raw
On 04/12/2013 01:29 PM, Ana Dionísio wrote:
> That only puts the data in one column, I wanted to separate it.
>
> For example:
> data in csv file:
>
> 1 2 3 4 5
> 7 8 9 10 11
> a b c d e
>
> I wanted an array where I could pick an element in each position. In the case above if I did print array[0][3] it would pick 4
>
I know nothing about numpy.
How about something like:
import csv
myreader = csv.reader(....)
mylist = list(myreader)
Presumably you can fill in the details. Anyway, I think this will give
you a list of lists, and perhaps you can convert that to a numpy array,
if you really need one of those.
--
DaveA
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Re: CSV to matrix array Jean-Michel Pichavant <jeanmichel@sequans.com> - 2013-04-12 19:23 +0200
Re: CSV to matrix array Ana Dionísio <anadionisio257@gmail.com> - 2013-04-12 10:29 -0700
Re: CSV to matrix array Dave Angel <davea@davea.name> - 2013-04-12 13:46 -0400
Re: CSV to matrix array Javier Miranda <javier@codecoa.com> - 2013-04-12 17:45 -0500
Re: CSV to matrix array cantorp@gmail.com - 2013-04-13 10:06 -0700
Re: CSV to matrix array cantorp@gmail.com - 2013-04-13 10:06 -0700
Re: CSV to matrix array Ana Dionísio <anadionisio257@gmail.com> - 2013-04-12 10:29 -0700
csiph-web