Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Datatime stored in DataFrame loses tz info and it goes to hour:minute #14148

Closed
leagto opened this issue Sep 4, 2016 · 2 comments
Closed

Datatime stored in DataFrame loses tz info and it goes to hour:minute #14148

leagto opened this issue Sep 4, 2016 · 2 comments
Labels
Bug Duplicate Report Duplicate issue or pull request Indexing Related to indexing on series/frames, not to indexes themselves Timezones Timezone data dtype

Comments

@leagto
Copy link

leagto commented Sep 4, 2016

#With this code:
#-----------------------------
from datetime import datetime
import pytz
from pandas import DataFrame

original_date = datetime(2016, 9, 2, 0, 0, 0, 0, pytz.timezone('America/Manaus'))
dataframe = DataFrame(columns = ['stored_date'])
dataframe.loc['A'] = [original_date]

print("I expect it shows '2016-09-02T00:00:00-04:00', but it shows '2016-09-02 04:00:00'...")
print("original_date:            " + original_date.isoformat())
print("stored_date in dataframe: " + str(dataframe.loc['A', 'stored_date']))
#-----------------------------
#I get this output:
#-----------------------------
I expect it shows '2016-09-02T00:00:00-04:00', but it shows '2016-09-02 04:00:00'...
original_date:            2016-09-02T00:00:00-04:00
stored_date in dataframe: 2016-09-02 04:00:00
#-----------------------------
#Output from pd.show_versions()
commit: None
python: 3.5.2.final.0
python-bits: 64
OS: Linux
OS-release: 4.7.1-1-ARCH
machine: x86_64
processor: 
byteorder: little
LC_ALL: None
LANG: pt_BR.utf8

pandas: 0.18.1
nose: None
pip: 8.1.2
setuptools: 26.0.0
Cython: 0.24.1
numpy: 1.11.1
scipy: 0.18.0
statsmodels: None
xarray: None
IPython: None
sphinx: None
patsy: None
dateutil: 2.5.3
pytz: 2016.6.1
blosc: None
bottleneck: 1.1.0
tables: 3.2.3.1
numexpr: 2.6.1
matplotlib: 1.5.2
openpyxl: None
xlrd: None
xlwt: None
xlsxwriter: None
lxml: None
bs4: None
html5lib: None
httplib2: None
apiclient: None
sqlalchemy: 1.0.14
pymysql: None
psycopg2: None
jinja2: 2.8
boto: None
pandas_datareader: 0.2.1

@jreback
Copy link
Contributor

jreback commented Sep 4, 2016

this is a duplicate of #11365

@jreback jreback closed this as completed Sep 4, 2016
@jreback jreback added Bug Indexing Related to indexing on series/frames, not to indexes themselves Duplicate Report Duplicate issue or pull request Timezones Timezone data dtype labels Sep 4, 2016
@jreback jreback added this to the No action milestone Sep 4, 2016
@leagto
Copy link
Author

leagto commented Sep 4, 2016

Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Duplicate Report Duplicate issue or pull request Indexing Related to indexing on series/frames, not to indexes themselves Timezones Timezone data dtype
Projects
None yet
Development

No branches or pull requests

2 participants