Skip to content

Commit 42914f3

Browse files
Backport PR #55180 on branch 2.1.x (MAINT: Cleanup expired ndarray methods) (#55184)
Backport PR #55180: MAINT: Cleanup expired ndarray methods Co-authored-by: Mateusz Sokół <[email protected]>
1 parent 3b57c19 commit 42914f3

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

doc/source/user_guide/gotchas.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -379,7 +379,7 @@ constructors using something similar to the following:
379379
.. ipython:: python
380380
381381
x = np.array(list(range(10)), ">i4") # big endian
382-
newx = x.byteswap().newbyteorder() # force native byteorder
382+
newx = x.byteswap().view(x.dtype.newbyteorder()) # force native byteorder
383383
s = pd.Series(newx)
384384
385385
See `the NumPy documentation on byte order

pandas/io/stata.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1771,7 +1771,7 @@ def read(
17711771
self._data_read = True
17721772
# if necessary, swap the byte order to native here
17731773
if self._byteorder != self._native_byteorder:
1774-
raw_data = raw_data.byteswap().newbyteorder()
1774+
raw_data = raw_data.byteswap().view(raw_data.dtype.newbyteorder())
17751775

17761776
if convert_categoricals:
17771777
self._read_value_labels()

0 commit comments

Comments
 (0)