Skip to content

Commit

Permalink
COMPAT: Update for NumPy dev (pandas-dev#17987)
Browse files Browse the repository at this point in the history
  • Loading branch information
TomAugspurger authored and jreback committed Oct 27, 2017
1 parent 37c9cea commit dff5109
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 dff5109

Please sign in to comment.