Skip to content

Slicing with duplicate index values error #1480

Closed
@wesm

Description

@wesm
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

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions