We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent c471b84 commit 2e70081Copy full SHA for 2e70081
pandas/core/matrix.py
@@ -520,8 +520,17 @@ def __getitem__(self, item):
520
This is a magic method. Do NOT call explicity.
521
"""
522
if isinstance(item, slice):
523
- indexRange = self.index[item]
524
- return self.reindex(indexRange)
+ new_index = self.index[item]
+ new_values = self.values[item].copy()
525
+
526
+ if self.objects is not None:
527
+ new_objects = self.objects.reindex(new_index)
528
+ else:
529
+ new_objects = None
530
531
+ return DataMatrix(new_values, index=new_index,
532
+ columns=self.columns,
533
+ objects=new_objects)
534
535
elif isinstance(item, np.ndarray):
536
if len(item) != len(self.index):
0 commit comments