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 peterpanmj committed Oct 31, 2017
1 parent d2e8287 commit cd7d9e8
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 cd7d9e8

Please sign in to comment.