Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #86737
| Path | csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed4.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!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.008 |
| X-Spam-Evidence | '*H*': 0.98; '*S*': 0.00; 'from:addr:yahoo.co.uk': 0.04; 'lawrence': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'language.': 0.14; 'csv': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'language': 0.16; 'wrote:': 0.18; 'trying': 0.19; 'file,': 0.19; 'import': 0.22; 'header:User-Agent:1': 0.23; 'cheers,': 0.24; 'header:X-Complaints-To:1': 0.27; 'header:In-Reply-To:1': 0.27; 'tried': 0.27; "d'aprano": 0.31; 'steven': 0.31; 'file': 0.32; 'weeks': 0.32; 'week.': 0.33; 'but': 0.35; 'really': 0.36; 'url:org': 0.36; 'should': 0.36; 'to:addr:python-list': 0.38; 'to:addr:python.org': 0.39; 'skip:p 20': 0.39; 'received:org': 0.40; 'first': 0.61; 'complete': 0.62; 'our': 0.64; 'charset:windows-1252': 0.65; 'day': 0.76; 'received:2': 0.84 |
| X-Injected-Via-Gmane | http://gmane.org/ |
| To | python-list@python.org |
| From | Mark Lawrence <breamoreboy@yahoo.co.uk> |
| Subject | Re: date |
| Date | Mon, 02 Mar 2015 14:26:27 +0000 |
| References | <slrnmf8hqo.6hg.maus@gmaus.info> <md1ks9$epb$1@speranza.aioe.org> |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=windows-1252; format=flowed |
| Content-Transfer-Encoding | 7bit |
| X-Gmane-NNTP-Posting-Host | host-2-98-199-155.as13285.net |
| User-Agent | Mozilla/5.0 (Windows NT 6.3; WOW64; rv:31.0) Gecko/20100101 Thunderbird/31.5.0 |
| In-Reply-To | <md1ks9$epb$1@speranza.aioe.org> |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.19 |
| 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.40.1425306406.13471.python-list@python.org> (permalink) |
| Lines | 28 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1425306406 news.xs4all.nl 2926 [2001:888:2000:d::a6]:54257 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:86737 |
Show key headers only | View raw
On 02/03/2015 12:25, Fabien wrote:
> On 02.03.2015 12:55, greymausg wrote:
>> I have a csv file, the first item on a line is the date in the format
>> 2015-03-02 I try to get that as a date by date(row[0]), but it barfs,
>> replying "Expecting an integer". (I am really trying to get the offset
>> in weeks from that date to today())
>
> Have you tried Pandas? http://pandas.pydata.org/
>
> If your csv file has no other problems, the following should do the trick:
>
> import pandas as pd
> df = pd.read_csv('file.csv', index_col=0, parse_dates= {"time" : [0]})
>
> Cheers,
>
> Fabien
>
IMHO complete overkill. Give me the Steven D'Aprano solution any day of
the week.
--
My fellow Pythonistas, ask not what our language can do for you, ask
what you can do for our language.
Mark Lawrence
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
date greymausg <maus@mail.com> - 2015-03-02 11:55 +0000
Re: date Fabien <fabien.maussion@gmail.com> - 2015-03-02 13:25 +0100
Re: date Mark Lawrence <breamoreboy@yahoo.co.uk> - 2015-03-02 14:26 +0000
Re: date Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2015-03-03 01:44 +1100
Re: date Tim Golden <mail@timgolden.me.uk> - 2015-03-02 14:50 +0000
Re: date Mark Lawrence <breamoreboy@yahoo.co.uk> - 2015-03-02 15:24 +0000
Re: date Chris Angelico <rosuav@gmail.com> - 2015-03-03 02:51 +1100
Re: date alister <alister.nospam.ware@ntlworld.com> - 2015-03-02 16:09 +0000
Re: date Chris Angelico <rosuav@gmail.com> - 2015-03-03 03:25 +1100
Re: date Dave Angel <davea@davea.name> - 2015-03-02 13:32 -0500
Re: date Mark Lawrence <breamoreboy@yahoo.co.uk> - 2015-03-02 16:44 +0000
Re: date Fabien <fabien.maussion@gmail.com> - 2015-03-02 16:42 +0100
Re: date Mark Lawrence <breamoreboy@yahoo.co.uk> - 2015-03-02 16:41 +0000
Re: date greymausg <maus@mail.com> - 2015-03-02 14:49 +0000
Re: date Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2015-03-02 23:45 +1100
Re: date greymausg <maus@mail.com> - 2015-03-02 14:49 +0000
Re: date greymausg <maus@mail.com> - 2015-03-02 17:55 +0000
csiph-web