summaryrefslogtreecommitdiff
path: root/numpy/doc/byteswapping.py
diff options
context:
space:
mode:
Diffstat (limited to 'numpy/doc/byteswapping.py')
-rw-r--r--numpy/doc/byteswapping.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/numpy/doc/byteswapping.py b/numpy/doc/byteswapping.py
index 8632e9794..ffefe3168 100644
--- a/numpy/doc/byteswapping.py
+++ b/numpy/doc/byteswapping.py
@@ -134,5 +134,14 @@ the previous operations:
>>> swapped_end_arr.tostring() == big_end_str
False
+An easier way of casting the data to a specific dtype and byte ordering
+can be achieved with the ndarray astype method:
+
+>>> swapped_end_arr = big_end_arr.astype('<i2')
+>>> swapped_end_arr[0]
+1
+>>> swapped_end_arr.tostring() == big_end_str
+False
+
"""
from __future__ import division, absolute_import, print_function