summaryrefslogtreecommitdiff
path: root/numpy/core/numeric.py
diff options
context:
space:
mode:
Diffstat (limited to 'numpy/core/numeric.py')
-rw-r--r--numpy/core/numeric.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/numpy/core/numeric.py b/numpy/core/numeric.py
index a85e8514c..57784a51f 100644
--- a/numpy/core/numeric.py
+++ b/numpy/core/numeric.py
@@ -131,7 +131,9 @@ def zeros_like(a, dtype=None, order='K', subok=True):
"""
res = empty_like(a, dtype=dtype, order=order, subok=subok)
- multiarray.copyto(res, 0, casting='unsafe')
+ # needed instead of a 0 to get same result as zeros for for string dtypes
+ z = zeros(1, dtype=res.dtype)
+ multiarray.copyto(res, z, casting='unsafe')
return res
def ones(shape, dtype=None, order='C'):