Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #73074
| Path | csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!xlned.com!feeder7.xlned.com!newsfeed.xs4all.nl!newsfeed2a.news.xs4all.nl!xs4all!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.004 |
| X-Spam-Evidence | '*H*': 0.99; '*S*': 0.00; 'skip:[ 20': 0.04; 'dependency': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; '"""),': 0.16; '00:00:00': 0.16; 'arrays?': 0.16; 'csv': 0.16; 'numpy': 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; 'storing': 0.16; 'subject:dates': 0.16; 'symbols': 0.16; 'wrote:': 0.18; 'numerical': 0.19; '>>>': 0.22; 'header:User-Agent:1': 0.23; 'convenient': 0.24; 'looks': 0.24; 'header:X-Complaints-To:1': 0.27; 'skip:p 30': 0.29; 'file': 0.32; 'lists': 0.32; "can't": 0.35; 'subject:lists': 0.35; 'dates': 0.36; 'lists.': 0.38; 'to:addr:python-list': 0.38; 'to:addr:python.org': 0.39; 'skip:p 20': 0.39; 'received:org': 0.40; 'read': 0.60; 'skip:2 20': 0.60; 'name:': 0.61; 'more': 0.64; 'series': 0.66; 'subject:. ': 0.67; 'advantages': 0.68; 'date,': 0.68; '10.1': 0.84 |
| X-Injected-Via-Gmane | http://gmane.org/ |
| To | python-list@python.org |
| From | Peter Otten <__peter__@web.de> |
| Subject | Re: lists vs. NumPy arrays for sets of dates and strings |
| Date | Tue, 10 Jun 2014 09:18:30 +0200 |
| Organization | None |
| References | <9b60eed1-1924-43d8-a92c-43b792118ebb@googlegroups.com> |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset="ISO-8859-1" |
| Content-Transfer-Encoding | 7Bit |
| X-Gmane-NNTP-Posting-Host | p57bdbc2d.dip0.t-ipconnect.de |
| User-Agent | KNode/4.11.5 |
| 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.10943.1402384746.18130.python-list@python.org> (permalink) |
| Lines | 40 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1402384746 news.xs4all.nl 2951 [2001:888:2000:d::a6]:34918 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:73074 |
Show key headers only | View raw
beliavsky@aol.com.dmarc.invalid wrote:
> I am going to read a multivariate time series from a CSV file that looks
> like
>
> Date,A,B
> 2014-01-01,10.0,20.0
> 2014-01-02,10.1,19.9
> ...
>
> The numerical data I will store in a NumPy array, since they are more
> convenient to work with than lists of lists. What are the advantages and
> disadvantages of storing the symbols [A,B] and dates
> [2014-01-01,2014-01-02] as lists vs. NumPy arrays?
If you don't mind the numpy dependency I can't see any disadvantages.
You might also have a look at pandas:
>>> ts = pandas.read_csv(io.StringIO("""\
... Date,A,B
... 2014-01-01,10.0,20.0
... 2014-01-02,10.1,19.9
... """), parse_dates=[0])
>>> ts
Date A B
0 2014-01-01 00:00:00 10.0 20.0
1 2014-01-02 00:00:00 10.1 19.9
>>> ts["A"]
0 10.0
1 10.1
Name: A, dtype: float64
>>> ts["Date"]
0 2014-01-01 00:00:00
1 2014-01-02 00:00:00
Name: Date, dtype: datetime64[ns]
>>> ts["Date"][0]
Timestamp('2014-01-01 00:00:00', tz=None)
>>> pylab.show(ts.plot(x="Date", y=["A", "B"]))
Back to comp.lang.python | Previous | Next — Previous in thread | Find similar | Unroll thread
lists vs. NumPy arrays for sets of dates and strings beliavsky@aol.com - 2014-06-09 12:48 -0700 Re: lists vs. NumPy arrays for sets of dates and strings Denis McMahon <denismfmcmahon@gmail.com> - 2014-06-09 20:50 +0000 Re: lists vs. NumPy arrays for sets of dates and strings Peter Otten <__peter__@web.de> - 2014-06-10 09:18 +0200
csiph-web