Skip to content

Slicing with duplicate index values error #1480

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

Closed
wesm opened this issue Jun 15, 2012 · 0 comments
Closed

Slicing with duplicate index values error #1480

wesm opened this issue Jun 15, 2012 · 0 comments
Assignees
Labels
Milestone

Comments

@wesm
Copy link
Member

wesm commented Jun 15, 2012

If one has data with non-unique indices like this one:
                        X.3 
X.1_X.2                            
2004-01-02 08:12:30  1.2586  
2004-01-02 08:12:31  1.2586  
2004-01-02 08:12:32  1.2586  
2004-01-02 08:12:32  1.2585  
2004-01-02 08:12:36  1.2585  
2004-01-02 08:12:37  1.2585  

and one does a slicing like:
data[datetime(2004,1,2,8,12,32):]
it fails with

IndexError: invalid slice

Should it work ?

Jochen

whole traceback:

/home/jgarcke/Prog/lib64/python2.6/site-packages/pandas-0.8.0b2-py2.6-linux-x86_64.egg/pandas/core/frame.pyc in __getitem__(self, key)
   1572             else:
   1573                 indexer = self.ix._convert_to_indexer(key, axis=0)
-> 1574             new_data = self._data.get_slice(indexer, axis=1)
   1575             return self._constructor(new_data)
   1576         # either boolean or fancy integer index


/home/jgarcke/Prog/lib64/python2.6/site-packages/pandas-0.8.0b2-py2.6-linux-x86_64.egg/pandas/core/internals.pyc in get_slice(self, slobj, axis)
    651     def get_slice(self, slobj, axis=0):
    652         new_axes = list(self.axes)
--> 653         new_axes[axis] = new_axes[axis][slobj]
    654 
    655         if axis == 0:

/home/jgarcke/Prog/lib64/python2.6/site-packages/pandas-0.8.0b2-py2.6-linux-x86_64.egg/pandas/tseries/index.pyc in __getitem__(self, key)
   1040                     new_offset = self.offset
   1041 
-> 1042             result = arr_idx[key]
   1043             if result.ndim > 1:
   1044                 return result

IndexError: invalid slice
@ghost ghost assigned wesm Jun 15, 2012
@wesm wesm closed this as completed in 6a67e3b Jun 19, 2012
yarikoptic added a commit to neurodebian/pandas that referenced this issue Jun 21, 2012
* commit 'v0.8.0b2-68-g7240b87': (68 commits)
  TST: additional coverage and cruft removal for ts plotting pandas-dev#1245
  BUG: test coverage, groupby bug fixes
  BUG: fix NumPy 1.7 argmin workaround, test coverage
  BUG: out of bounds on buffer access if time doesn't exist in TimeSeries.at_time
  BUG: revert mpl hackaround
  TST: resample test coverage etc. pandas-dev#1245
  BUG: test coverage and misc bug fixes, cruft deletion in period.py pandas-dev#1245
  TST: finish test coverage of pandas.tseries.index pandas-dev#1245
  BUG: fix closed='left' resample bug. test coverage pandas-dev#1245
  TST: test coverage pandas-dev#1245
  BUG: raise exception in DataFrame.fillna when axis=1 and pass dict/Series. close pandas-dev#1485
  BUG: fillna called with Series should be analogous to with dict close pandas-dev#1486
  BUG: fix MS/BMS range generation / onOffset bugs causing pandas-dev#1483
  ENH: at_time/between_time work with tz-localized time series. refactoring and cleanup close pandas-dev#1481
  BUG: label slicing with duplicate values, close pandas-dev#1480
  TST: remove rogue print statement
  BUG: fixed broken imports
  BUG: do not convert bday freq in ts plots pandas-dev#1482
  BUG: mask NaNs in non-ts plots
  TST: test case for tseries plots with data gaps
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant