- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Found 1204 Articles for Numpy
![AmitDiwan](https://www.tutorialspoint.com/assets/profiles/123055/profile/60_187394-1565938756.jpg)
842 Views
To compute the bit-wise XOR of two arrays element-wise, use the numpy.bitwise_xor() method in Python Numpy. Computes the bit-wise XOR of the underlying binary representation of the integers in the input arrays. This ufunc implements the C/Python operator ^.The 1st and 2nd parameter are the arrays, only integer and boolean types are handled. If x1.shape != x2.shape, they must be broadcastable to a common shape.The where parameter is the condition broadcast over the input. At locations where the condition is True, the out array will be set to the ufunc result. Elsewhere, the out array will retain its original value. ... Read More
![AmitDiwan](https://www.tutorialspoint.com/assets/profiles/123055/profile/60_187394-1565938756.jpg)
187 Views
To true divide each element of a masked Array by a scalar value in-place, use the ma.MaskedArray.__itruediv__() method in Python Numpy.A masked array is the combination of a standard numpy.ndarray and a mask. A mask is either nomask, indicating that no value of the associated array is invalid, or an array of booleans that determines for each element of the associated array whether the value is valid or not.NumPy offers comprehensive mathematical functions, random number generators, linear algebra routines, Fourier transforms, and more. It supports a wide range of hardware and computing platforms, and plays well with distributed, GPU, and ... Read More
![AmitDiwan](https://www.tutorialspoint.com/assets/profiles/123055/profile/60_187394-1565938756.jpg)
283 Views
To compute the bit-wise XOR of a 1D and a 2D array element-wise, use the numpy.bitwise_xor() method in Python Numpy.Computes the bit-wise XOR of the underlying binary representation of the integers in the input arrays. This ufunc implements the C/Python operator ^.The 1st and 2nd parameter are the arrays, only integer and boolean types are handled. If x1.shape != x2.shape, they must be broadcastable to a common shape.StepsAt first, import the required library −import numpy as npCreating two numpy arrays using the array() method. We have inserted elements of int type −arr1 = np.array([32, 95, 82, 69, 38, 49]) arr2 ... Read More
![AmitDiwan](https://www.tutorialspoint.com/assets/profiles/123055/profile/60_187394-1565938756.jpg)
281 Views
To add a scalar value with each element of a masked Array in-place, use the ma.MaskedArray.__iadd__() method in Python Numpy.A masked array is the combination of a standard numpy.ndarray and a mask. A mask is either nomask, indicating that no value of the associated array is invalid, or an array of booleans that determines for each element of the associated array whether the value is valid or not.NumPy offers comprehensive mathematical functions, random number generators, linear algebra routines, Fourier transforms, and more. It supports a wide range of hardware and computing platforms, and plays well with distributed, GPU, and sparse ... Read More
![AmitDiwan](https://www.tutorialspoint.com/assets/profiles/123055/profile/60_187394-1565938756.jpg)
352 Views
To replace tab characters by a fixed tabsize in a string array, use the numpy.char.expandtabs() method in Python Numpy. The "tabsize" parameter is used to replace tabs with tabsize number of spaces. If not given defaults to 8 spaces.The function expandtabs() returns a copy of each string element where all tab characters are replaced by one or more spaces, depending on the current column and the given tabsize. The column number is reset to zero after each newline occurring in the string. This doesn’t understand other non-printing characters or escape sequences.The numpy.char module provides a set of vectorized string operations ... Read More
![AmitDiwan](https://www.tutorialspoint.com/assets/profiles/123055/profile/60_187394-1565938756.jpg)
79 Views
To return a copy of each string element where all tab characters are replaced by spaces, use the numpy.char.expandtabs() method in Python Numpy. We can also set the "tabsize" parameter i.e. replace tabs with tabsize number of spaces. If not given defaults to 8 spaces.The function expandtabs() returns a copy of each string element where all tab characters are replaced by one or more spaces, depending on the current column and the given tabsize. The column number is reset to zero after each newline occurring in the string. This doesn’t understand other non-printing characters or escape sequences.The numpy.char module provides ... Read More
![AmitDiwan](https://www.tutorialspoint.com/assets/profiles/123055/profile/60_187394-1565938756.jpg)
760 Views
To decode string array values that is already encoded, use the numpy.char.decode() method in Python Numpy. The "encoding" parameter sets the name of the encode used while encoding. The set of available codecs comes from the Python standard library, and may be extended at runtime. The type of the result will depend on the encoding specified.The numpy.char module provides a set of vectorized string operations for arrays of type numpy.str_ or numpy.bytes_.StepsAt first, import the required library −import numpy as npCreate a One-Dimensional array of string −arr = np.array(['Bella', 'Tom', 'John', 'Kate', 'Amy', 'Brad']) Displaying our array −print("Array...", arr)Get the ... Read More
![AmitDiwan](https://www.tutorialspoint.com/assets/profiles/123055/profile/60_187394-1565938756.jpg)
950 Views
To encode string array values, use the numpy.char.encode() method in Python Numpy. The arr is the input array to be encoded. The "encoding" parameter sets the name of the encode. The set of available codecs comes from the Python standard library, and may be extended at runtime. The type of the result will depend on the encoding specified.The numpy.char module provides a set of vectorized string operations for arrays of type numpy.str_ or numpy.bytes_.StepsAt first, import the required library −import numpy as npCreate a One-Dimensional array of string −arr = np.array(['zbellazz' 'zztoMzzz' 'zzjohnzz' 'zzkatEzz' 'zzamyzzz' 'zzbradzz'])Displaying our array −print("Array...", arr)Get ... Read More
![AmitDiwan](https://www.tutorialspoint.com/assets/profiles/123055/profile/60_187394-1565938756.jpg)
83 Views
To return a copy of an array with its elements centered in a string of length width, use the numpy.char.center() method in Python Numpy. The width is the length of the resulting strings. The function returns the output array of str or unicode, depending on input types.The numpy.char module provides a set of vectorized string operations for arrays of type numpy.str_ or numpy.bytes_.StepsAt first, import the required library −import numpy as npCreate a One-Dimensional array of string −arr = np.array(['bella', 'toM', 'john', 'katE', 'amy', 'brad']) Displaying our array −print("Array...", arr)Get the datatype −print("Array datatype...", arr.dtype) Get the dimensions of the ... Read More
![AmitDiwan](https://www.tutorialspoint.com/assets/profiles/123055/profile/60_187394-1565938756.jpg)
133 Views
To get the number of elements of the Masked Array, use the ma.MaskedArray.size attribute in Numpy. The array.size returns a standard arbitrary precision Python integer. This may not be the case with other methods of obtaining the same value, which returns an instance of np.int_), and may be relevant if the value is used further in calculations that may overflow a fixed size integer type.A mask is either nomask, indicating that no value of the associated array is invalid, or an array of booleans that determines for each element of the associated array whether the value is valid or not.StepsAt ... Read More