From cb0101b8a8733900cae63e279c20286d73cdb440 Mon Sep 17 00:00:00 2001 From: Tom Augspurger Date: Wed, 25 Oct 2017 16:32:54 -0500 Subject: [PATCH] COMPAT: Update for NumPy dev Closes https://github.com/pandas-dev/pandas/issues/17986 xref https://github.com/numpy/numpy/pull/9487 --- pandas/io/packers.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/pandas/io/packers.py b/pandas/io/packers.py index 92270b39f56ef..abd258034af99 100644 --- a/pandas/io/packers.py +++ b/pandas/io/packers.py @@ -350,8 +350,11 @@ def unconvert(values, dtype, compress=None): ) # fall through to copying `np.fromstring` - # Copy the string into a numpy array. - return np.fromstring(values, dtype=dtype) + # Copy the bytes into a numpy array. + buf = np.frombuffer(values, dtype=dtype) + buf = buf.copy() # required to not mutate the original data + buf.flags.writeable = True + return buf def encode(obj):