
- NumPy Tutorial
- NumPy - Home
- NumPy - Introduction
- NumPy - Environment
- NumPy - Ndarray Object
- NumPy - Data Types
- NumPy - Array Attributes
- NumPy - Array Creation Routines
- NumPy - Array from Existing Data
- Array From Numerical Ranges
- NumPy - Indexing & Slicing
- NumPy - Advanced Indexing
- NumPy - Broadcasting
- NumPy - Iterating Over Array
- NumPy - Array Manipulation
- NumPy - Binary Operators
- NumPy - String Functions
- NumPy - Mathematical Functions
- NumPy - Arithmetic Operations
- NumPy - Statistical Functions
- Sort, Search & Counting Functions
- NumPy - Byte Swapping
- NumPy - Copies & Views
- NumPy - Matrix Library
- NumPy - Linear Algebra
- NumPy - Matplotlib
- NumPy - Histogram Using Matplotlib
- NumPy - I/O with NumPy
- NumPy Useful Resources
- NumPy - Quick Guide
- NumPy - Useful Resources
- NumPy - Discussion
NumPy - right_shift
The numpy.right_shift() function shift the bits in the binary representation of an array element to the right by specified positions, and an equal number of 0s are appended from the left.
import numpy as np print 'Right shift 40 by two positions:' print np.right_shift(40,2) print '\n' print 'Binary representation of 40:' print np.binary_repr(40, width = 8) print '\n' print 'Binary representation of 10' print np.binary_repr(10, width = 8) # Two bits in '00001010' are shifted to right and two 0s appended from left.
Its output would be as follows −
Right shift 40 by two positions: 10 Binary representation of 40: 00101000 Binary representation of 10 00001010
numpy_binary_operators.htm
Advertisements