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 12e690f1e..5d7407ce0 100644
--- a/numpy/core/numeric.py
+++ b/numpy/core/numeric.py
@@ -133,7 +133,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'):