Last active
August 29, 2015 14:01
-
-
Save danbirken/cfd489282f54bc94d3ec to your computer and use it in GitHub Desktop.
Revisions
-
danbirken revised this gist
May 23, 2014 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -17,7 +17,7 @@ Name: dt, dtype: object In [3]: df['dt'][0] Out[3]: Timestamp('2014-05-23 15:43:12.731037-0700', tz='psycopg2.tz.FixedOffsetTimezone(offset=-420, name=None)') # Datetime with time zone field remains a tz-aware timestamp In [4]: df['dt2'] Out[5]: -
danbirken revised this gist
May 23, 2014 . 1 changed file with 5 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -14,10 +14,13 @@ Out[2]: 0 2014-05-23 15:43:12.731037-07:00 Name: dt, dtype: object In [3]: df['dt'][0] Out[3]: Timestamp('2014-05-23 15:43:12.731037-0700', tz='psycopg2.tz.FixedOffsetTimezone(offset=-420, name=None)') # Datetime with time zone field remains a tz-aware datetime.datetime In [4]: df['dt2'] Out[5]: 0 2014-05-23 22:43:12.731046 Name: dt2, dtype: datetime64[ns] -
danbirken revised this gist
May 23, 2014 . 1 changed file with 2 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -14,11 +14,11 @@ Out[2]: 0 2014-05-23 15:43:12.731037-07:00 Name: dt, dtype: object # Datetime with time zone field remains a tz-aware datetime.datetime In [3]: df['dt2'] Out[3]: 0 2014-05-23 22:43:12.731046 Name: dt2, dtype: datetime64[ns] # Datetime without time zone is parsed into datetime64[ns] -
danbirken revised this gist
May 23, 2014 . 1 changed file with 5 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -14,7 +14,11 @@ Out[2]: 0 2014-05-23 15:43:12.731037-07:00 Name: dt, dtype: object # Datetime with time zone field not parsed into datetime64[ns] In [3]: df['dt2'] Out[3]: 0 2014-05-23 22:43:12.731046 Name: dt2, dtype: datetime64[ns] # Datetime without time zone is properly parsed into datetime64[ns] -
danbirken renamed this gist
May 23, 2014 . 1 changed file with 0 additions and 0 deletions.There are no files selected for viewing
File renamed without changes. -
danbirken created this gist
May 23, 2014 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,20 @@ IPython 1.0.0 -- An enhanced Interactive Python. ? -> Introduction and overview of IPython's features. %quickref -> Quick reference. help -> Python's own help system. object? -> Details about 'object', use 'object??' for extra details. In [1]: df Out[1]: id dt dt2 0 1 2014-05-23 15:43:12.731037-07:00 2014-05-23 22:43:12.731046 In [2]: df['dt'] Out[2]: 0 2014-05-23 15:43:12.731037-07:00 Name: dt, dtype: object In [3]: df['dt2'] Out[3]: 0 2014-05-23 22:43:12.731046 Name: dt2, dtype: datetime64[ns] This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,27 @@ import sqlalchemy from sqlalchemy import create_engine from sqlalchemy.ext.declarative import declarative_base from sqlalchemy.orm import sessionmaker import datetime Base = declarative_base() engine = create_engine('postgresql://postgres:@localhost/testing') session = sessionmaker(bind=engine)() class Test(Base): __tablename__ = 'testing' id = sqlalchemy.Column(sqlalchemy.Integer, primary_key=True) dt = sqlalchemy.Column(sqlalchemy.DateTime(timezone=True)) dt2 = sqlalchemy.Column(sqlalchemy.DateTime()) Base.metadata.create_all(engine) session.add(Test(dt=datetime.datetime.now(), dt2=datetime.datetime.utcnow())) session.commit() session.flush() import pandas as pd df = pd.read_sql_table('testing', engine)