From c06726daa4d57893bc6132c3f311bd14ec6dc110 Mon Sep 17 00:00:00 2001 From: Allan Haldane Date: Fri, 6 Nov 2015 12:32:39 -0500 Subject: ENH: make recarray.getitem return a recarray recarray.__getitem__ should return a recarray when the returned value had structured type (it's documented to do so). Fixes #6641 --- numpy/core/records.py | 1 + 1 file changed, 1 insertion(+) (limited to 'numpy/core/records.py') diff --git a/numpy/core/records.py b/numpy/core/records.py index 4ce3fe98a..b07755384 100644 --- a/numpy/core/records.py +++ b/numpy/core/records.py @@ -502,6 +502,7 @@ class recarray(ndarray): # we might also be returning a single element if isinstance(obj, ndarray): if obj.dtype.fields: + obj = obj.view(recarray) if issubclass(obj.dtype.type, nt.void): return obj.view(dtype=(self.dtype.type, obj.dtype)) return obj -- cgit v1.2.1