Skip to content

Commit

Permalink
COMPAT: Update for NumPy dev (pandas-dev#17987)
Browse files Browse the repository at this point in the history
Closes pandas-dev#17986

xref numpy/numpy#9487

(cherry picked from commit dff5109)
  • Loading branch information
TomAugspurger committed Dec 8, 2017
1 parent 6a4567e commit ba36a14
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions pandas/io/packers.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down

0 comments on commit ba36a14

Please sign in to comment.