-
-
Notifications
You must be signed in to change notification settings - Fork 18.2k
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
unique(), values discards timezone information in some cases #14548
Comments
discussion here: #13395 To summarize:
DTI return another DTI as So this IS different for a DTI and a Series for It has been this way for quite some time and its not worth it to return a '1-D' object for See my comments in the xref issue. |
Maybe we should an explanation about this somewhere in the docs as a FAQ or gotcha, to which we can refer when this comes up. |
could update the doc strings with more xref to be honest .values use should be discouraged |
Thanks for the clear answer and sorry about not catching these other issues (somehow forgot to remove is:open while searching for past similar issues). as for .values, I can't say I found a very clear/consistent pattern to get the values out of a Series/DF to pass to non-pandas functions/objects. |
@aavanian many functions that expect a numpy array also can handle a Series, but if you need the values, then |
Not sure if it's an expected behavior. This seems strange to me.
A small, complete example of the issue
Expected Output
Outputs of pd.DatetimeIndex.values, pd.Series.unique() and pd.Series.values should be preserve the timezone information.
Note: I did a quick test with Python 3.4.5 and pandas 0.19
only difference is (to be clear, rng.values and serie.values still discard the tzinfo):
Output of
pd.show_versions()
pandas: 0.18.1
nose: None
pip: 8.1.2
setuptools: 23.0.0
Cython: None
numpy: 1.11.0
scipy: 0.17.1
statsmodels: 0.6.1
xarray: None
IPython: 4.2.0
sphinx: None
patsy: 0.4.1
dateutil: 2.5.3
pytz: 2016.4
blosc: None
bottleneck: 1.0.0
tables: None
numexpr: 2.6.0
matplotlib: 1.5.1
openpyxl: 2.3.2
xlrd: 1.0.0
xlwt: None
xlsxwriter: 0.9.2
lxml: 3.6.0
bs4: None
html5lib: None
httplib2: None
apiclient: None
sqlalchemy: 1.0.13
pymysql: 0.7.6.None
psycopg2: None
jinja2: 2.8
boto: None
pandas_datareader: 0.2.1
The text was updated successfully, but these errors were encountered: