Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #44306
| Path | csiph.com!usenet.pasdenom.info!aioe.org!news.stack.nl!newsfeed.xs4all.nl!newsfeed4.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <oscar.j.benjamin@gmail.com> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.006 |
| X-Spam-Evidence | '*H*': 0.99; '*S*': 0.00; 'tutorial': 0.03; 'that?': 0.05; 'column': 0.07; 'subject:file': 0.07; 'rows': 0.09; 'subject:into': 0.09; 'cc:addr:python-list': 0.11; 'python': 0.11; 'suggest': 0.14; 'itself.': 0.14; 'array.': 0.16; 'csv': 0.16; 'numpy': 0.16; 'subject:CSV': 0.16; 'subject:Scan': 0.16; 'subject:array': 0.16; 'wrote:': 0.18; 'cc:addr:python.org': 0.22; 'instead.': 0.24; "shouldn't": 0.24; 'cc:2**0': 0.24; 'cc:no real name:2**0': 0.24; 'script': 0.25; '(for': 0.26; 'header:In-Reply- To:1': 0.27; 'tried': 0.27; 'array': 0.29; 'message- id:@mail.gmail.com': 0.30; 'file': 0.32; 'url:python': 0.33; 'problem': 0.35; 'received:209.85': 0.35; 'received:209.85.220': 0.35; 'but': 0.35; 'received:google.com': 0.35; 'add': 0.35; 'next': 0.36; 'url:org': 0.36; 'error.': 0.37; 'list': 0.37; 'received:209': 0.37; 'saves': 0.38; 'does': 0.39; 'first': 0.61; 'here:': 0.62; 'save': 0.62; 'skip:n 10': 0.64; 'more': 0.64; 'to:addr:gmail.com': 0.65; 'to:charset:iso-8859-1': 0.74; 'ana': 0.84; 'oscar': 0.84; 'this;': 0.91; '2013': 0.98 |
| DKIM-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:mime-version:in-reply-to:references:from:date:message-id :subject:to:cc:content-type:content-transfer-encoding; bh=+5yPM8K4iN8SZl2odd5N6xdb9kkj70/r9fRGu+W/8sA=; b=OzsknBmEX86cktNTifwLVxIFA/vJ027soTpDahNU3a8U9k9fhJBIzC7eYI+YUKS4b1 R7iiehDUpWaSqIwon5bS/VnzfH8qAZAGkOdrG65xJJsDiExwV1+t3lKHqDl9swU1Z/O5 1kzOHpgpGWbI3/TAfH73lrl0IavgaIWHE0gnmaSpKkbACH0M4m9Wfk8l06QDhwnwD2w8 gNduX/oMM4hoYatQO1KLTENrSoeb6rttqExQDAWvCOgXWxALvYpjKLeQSmeW5ZKrjQKt FhMkhsqVI8U+037V0FyHgBsqwkmgw9QnAs9VbDRPqnFQbA/MpTHSisggVKn9ZBvXywl0 sCBw== |
| X-Received | by 10.52.170.107 with SMTP id al11mr14680577vdc.123.1366849323589; Wed, 24 Apr 2013 17:22:03 -0700 (PDT) |
| MIME-Version | 1.0 |
| In-Reply-To | <1533da3c-a297-41a0-a575-968a86120a5b@googlegroups.com> |
| References | <1533da3c-a297-41a0-a575-968a86120a5b@googlegroups.com> |
| From | Oscar Benjamin <oscar.j.benjamin@gmail.com> |
| Date | Thu, 25 Apr 2013 01:21:43 +0100 |
| Subject | Re: Scan CSV file and saving it into an array |
| To | Ana Dionísio <anadionisio257@gmail.com> |
| Content-Type | text/plain; charset=ISO-8859-1 |
| Content-Transfer-Encoding | quoted-printable |
| Cc | python-list@python.org |
| 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.1042.1366849332.3114.python-list@python.org> (permalink) |
| Lines | 24 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1366849332 news.xs4all.nl 15878 [2001:888:2000:d::a6]:48948 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:44306 |
Show key headers only | View raw
On 25 April 2013 00:01, Ana Dionísio <anadionisio257@gmail.com> wrote:
> Hello!
>
> I have this script that scans a csv file and if the value in the first column == 200 it saves that row into an array.
>
> The problem is, I need to save that row and the next 10 rows in that same array. What can I add to the script so it does that? I tried to do for row in len(10): but I get an error.
>
>
> p = csv.reader(open('file.csv'), delimiter=';')
> a=[0]*2881
> a = numpy.array(a, dtype=dict)
You shouldn't be using a numpy array for this; use a list instead. I
suggest that you have a go at the Python tutorial and avoid using
numpy until you are more confident with the basics of Python itself.
The tutorial (for Python 2) is here:
http://docs.python.org/2/tutorial/
Oscar
Back to comp.lang.python | Previous | Next — Previous in thread | Find similar | Unroll thread
Scan CSV file and saving it into an array Ana Dionísio <anadionisio257@gmail.com> - 2013-04-24 16:01 -0700
Re: Scan CSV file and saving it into an array "Rhodri James" <rhodri@wildebst.demon.co.uk> - 2013-04-25 00:21 +0100
Re: Scan CSV file and saving it into an array Dave Angel <davea@davea.name> - 2013-04-24 19:47 -0400
Re: Scan CSV file and saving it into an array Dave Angel <davea@davea.name> - 2013-04-24 20:01 -0400
Re: Scan CSV file and saving it into an array Oscar Benjamin <oscar.j.benjamin@gmail.com> - 2013-04-25 01:21 +0100
csiph-web