dimanche 15 mars 2015

Parsing strings in a sqlite column as datetime with Pandas

I am trying to parse a splite column as datetime using Pandas, it worked out of the box when I was reading data from a csv but now that it is in a database it seems that I have to work a bit harder to have it recognised as a datetime in my dataframe .


I'm doing this at the moment :



conn = sqlite3.connect('DATA/db/asx.db')
c = conn.cursor()
df = pd.read_sql("SELECT * from binaries", conn)





print pd.to_datetime(df["DATE"])



797604 2015-03-02 16:00:33.345841


797605 2015-03-02 16:00:33.345836


797606 2015-03-02 16:00:33.345827


Name: DATE, Length: 797607, dtype: object



As you can see it doesn't seem to be parsing as datetime . Is there anything else I should try ?


thank you .


Aucun commentaire:

Enregistrer un commentaire