date

greymausg maus at mail.com
Mon Mar 2 09:49:42 EST 2015


On 2015-03-02, Fabien <fabien.maussion at gmail.com> 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]})

Ta. Will try

>
> Cheers,
>
> Fabien
>
>
>
>


-- 
greymaus
 .
  .
...



More information about the Python-list mailing list