summaryrefslogtreecommitdiff
path: root/numpy/lib/shape_base.py
diff options
context:
space:
mode:
authorRalf Gommers <ralf.gommers@gmail.com>2018-07-31 11:15:30 -0700
committerGitHub <noreply@github.com>2018-07-31 11:15:30 -0700
commitb0832bd6d28c4ec109184c37673984cdc677156c (patch)
tree880e44d48ddbf4909d50acb718d2bccbe05a19be /numpy/lib/shape_base.py
parenta591b4abca82df4361a34d7e4388335958c42808 (diff)
parent455b5c567f75486b121c33f82bcb8f8da9683b5a (diff)
downloadnumpy-b0832bd6d28c4ec109184c37673984cdc677156c.tar.gz
Merge pull request #11638 from eric-wieser/remove-ma.expand_dims
ENH: Make expand_dims work on subclasses
Diffstat (limited to 'numpy/lib/shape_base.py')
-rw-r--r--numpy/lib/shape_base.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/numpy/lib/shape_base.py b/numpy/lib/shape_base.py
index 65104115a..d31d8a939 100644
--- a/numpy/lib/shape_base.py
+++ b/numpy/lib/shape_base.py
@@ -536,7 +536,11 @@ def expand_dims(a, axis):
True
"""
- a = asarray(a)
+ if isinstance(a, matrix):
+ a = asarray(a)
+ else:
+ a = asanyarray(a)
+
shape = a.shape
if axis > a.ndim or axis < -a.ndim - 1:
# 2017-05-17, 1.13.0