date
Fabien
fabien.maussion at gmail.com
Mon Mar 2 07:25:47 EST 2015
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
More information about the Python-list
mailing list