Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #79271
| 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.001 |
| X-Spam-Evidence | '*H*': 1.00; '*S*': 0.00; 'context': 0.07; 'alain': 0.09; 'matplotlib': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'columns': 0.16; 'corresponds': 0.16; 'data...': 0.16; 'dhananjay': 0.16; 'line.split()': 0.16; 'option:': 0.16; 'received:80.91.229.3': 0.16; 'received:dip0.t-ipconnect.de': 0.16; 'received:plane.gmane.org': 0.16; 'received:t-ipconnect.de': 0.16; 'reedy': 0.16; 'simpson': 0.16; 'tuples,': 0.16; 'x,y,z': 0.16; 'wrote:': 0.18; '(the': 0.22; '>>>': 0.22; 'header:User-Agent:1': 0.23; 'script': 0.25; 'header:X-Complaints-To:1': 0.27; 'am,': 0.29; 'array': 0.29; '>>>>': 0.31; 'breaking': 0.31; 'though.': 0.31; 'writes:': 0.31; 'another': 0.32; 'there': 0.35; 'feed': 0.38; 'lists.': 0.38; 'to:addr:python-list': 0.38; 'skip:- 10': 0.38; 'to:addr:python.org': 0.39; 'received:org': 0.40; 'easy': 0.60; 'skip:n 30': 0.60; 'skip:y 20': 0.60; 'skip:z 20': 0.60; 'skip:o 30': 0.61; 'further': 0.61; 'subject:your': 0.76; '(total': 0.84 |
| X-Injected-Via-Gmane | http://gmane.org/ |
| To | python-list@python.org |
| From | Peter Otten <__peter__@web.de> |
| Subject | Re: your mail |
| Date | Sat, 18 Oct 2014 15:03:08 +0200 |
| Organization | None |
| References | <CAPxp-0Txqk-cWcpa=2uMQ6cwS57gnQU4xrjp+jO4y+Vn3kR1mQ@mail.gmail.com> <20141017104316.GA49644@cskk.homeip.net> <mailman.14947.1413563848.18130.python-list@python.org> <87ppdp39xv.fsf@dpt-info.u-strasbg.fr> |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset="ISO-8859-1" |
| Content-Transfer-Encoding | 7Bit |
| X-Gmane-NNTP-Posting-Host | p57bd8080.dip0.t-ipconnect.de |
| User-Agent | KNode/4.13.3 |
| 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 | <https://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 | <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.14969.1413637402.18130.python-list@python.org> (permalink) |
| Lines | 41 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1413637402 news.xs4all.nl 2863 [2001:888:2000:d::a6]:40628 |
| X-Complaints-To | abuse@xs4all.nl |
| Path | csiph.com!usenet.pasdenom.info!bete-des-vosges.org!feed.ac-versailles.fr!nerim.net!novso.com!newsfeed.xs4all.nl!newsfeed2a.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail |
| Xref | csiph.com comp.lang.python:79271 |
Show key headers only | View raw
Alain Ketterlin wrote:
> Terry Reedy <tjreedy@udel.edu> writes:
>
>> On 10/17/2014 6:43 AM, Cameron Simpson wrote:
>>> On 17Oct2014 11:45, Dhananjay <dhananjay.c.joshi@gmail.com> wrote:
>>
>>>> 2.1576318858 -1.8651195165 4.2333428278
>>>> ...
>>>> (total of 200 lines)
>>>>
>>>> Columns 1,2,3 corresponds to x,y,z axis data points.
>>
>>> for line in open('flooding-psiphi.dat','r'):
>>> line = line.split()
>>> xs.append(float(line[0]))
>>> ys.append(float(line[1]))
>>> zs.append(float(line[2]))
>>
>> A further refinement:
>> for line in open('flooding-psiphi.dat','r'):
>> x, y, z = map(float, line.split())
>> xs.append(x)
>> ys.append(y)
>> zs.append(z)
>
> Or even:
>
> xs,ys,zs = zip(*[ map(float,line.split())
> for line in open('flooding-psiphi.dat','r') ])
>
> You get tuples, though. Use map(list,zip(...)) if you need lists. Easy
> to update when you move to 4D data...
Given the context (the script uses numpy) there is another option:
xs, ys, zs = numpy.loadtxt('flooding-psiphi.dat').T
There may also be a way to feed the array to matplotlib without breaking it
into the three columns...
Back to comp.lang.python | Previous | Next — Previous in thread | Find similar | Unroll thread
Re: your mail Terry Reedy <tjreedy@udel.edu> - 2014-10-17 12:37 -0400
Re: your mail Alain Ketterlin <alain@dpt-info.u-strasbg.fr> - 2014-10-18 13:15 +0200
Re: your mail Peter Otten <__peter__@web.de> - 2014-10-18 15:03 +0200
csiph-web