-
-
Notifications
You must be signed in to change notification settings - Fork 18.5k
BUG: error in in _convert_to_indexer while using .loc with tz-aware DateTimeIndex #11679
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
Comments
pls show a copy-pastable example, and |
I'm experiencing a similar issue, specifically when using a DateTimeIndex as a major_axis in a panel. Somewhere inside the pandas indexing, the dtype of a time-zone aware DateTimeIndex is being stripped away. Copy-paste example: ########################################################################################## normal_panel = pd.Panel(items = axis_0, major_axis = axis_1, minor_axis = axis_2) normal_panel.ix[:,:,'d'] = 1. print normal_panel.ix[:,:,'e'] ########################################################################################## tz_panel = pd.Panel(items = axis_0, major_axis = axis_1, minor_axis = axis_2) tz_panel.ix[:,:,'d'] = 1. print tz_panel.ix[:,:,'e'] |
INSTALLED VERSIONScommit: None pandas: 0.17.0 |
Similarly I am able to produce joseRLC's issue when slicing on the major_axis: tz_panel.ix[:,tz_panel.major_axis[0:1],'d'] = tz_panel.ix[:,tz_panel.major_axis[0:1],'e']KeyError Traceback (most recent call last) C:\Anaconda2\lib\site-packages\pandas\core\indexing.pyc in setitem(self, key, value) C:\Anaconda2\lib\site-packages\pandas\core\indexing.pyc in _get_setitem_indexer(self, key) C:\Anaconda2\lib\site-packages\pandas\core\indexing.pyc in _convert_tuple(self, key, is_setter) C:\Anaconda2\lib\site-packages\pandas\core\indexing.pyc in _convert_to_indexer(self, obj, axis, is_setter) KeyError: "['2015-11-04T00:00:00.000000000-0600'] not in index" |
@JoseRLC issue title should probably say "...with tz_aware DateTimeIndex" The issue does not occur for non-tz_aware indices. |
@briandavidgreen you're right. Sorry! |
addtl example / repro in #13908
Hello,
I encounter some problems using the data provided here: data.txt
When I was trying to use .loc on my DateTimeIndex, I go t the following error
Notice that the error occurs only if we have the DST changing time in the DateTimeIndex
While debugging I've found that the error comes from the _convert_to_indexer method at:
Here is the copy-paste example using the data on the .txt attached:
Other important fact: the error occurs for pandas version 0.17.0 and 0.17.1. However, I've managed to make it work with an older version of pandas (0.16.2)
I hope this is explicit enough.
UPDATE
The text was updated successfully, but these errors were encountered: