- 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)
104 Views
To return a copy of the string with all occurrences of substring old replaced by new, use the numpy.char.replace() method in Python Numpy −The 1st parameter is the input arrayThe 2nd parameter is the old string to be replacedThe 3rd parameter is the new string to be replaced with the oldIf the optional parameter count is given, only the first count occurrences are replacedThe 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 an array −arr = np.array(["Welcome to the Jungle", "Jungle Safari"])Displaying our ... Read More
![AmitDiwan](https://www.tutorialspoint.com/assets/profiles/123055/profile/60_187394-1565938756.jpg)
125 Views
To return a copy of an array with the trailing characters removed, use the numpy.char.rstrip() method in Python Numpy. The "chars" parameter is used to set a string specifying the set of characters to be removed. If omitted or None, the chars argument defaults to removing whitespace. The chars argument is not a prefix; rather, all combinations of its values are stripped.The numpy.char module provides a set of vectorized string operations for arrays of type numpy.str_ or numpy.bytes_.The chars parameter is a string specifying the set of characters to be removed. If omitted or None, the chars argument defaults to ... Read More
![AmitDiwan](https://www.tutorialspoint.com/assets/profiles/123055/profile/60_187394-1565938756.jpg)
284 Views
To return True if two arrays are element-wise equal within a tolerance, use the ma.allclose() method in Python Numpy. This function is equivalent to allclose except that masked values are treated as equal (default) or unequal, depending on the masked_equal argument. The "masked_values" parameter is used to set the masked values in both the arrays are considered equal (True) or not (False).Returns True if the two arrays are equal within the given tolerance, False otherwise. If either array contains NaN, then False is returned.A masked array is the combination of a standard numpy.ndarray and a mask. A mask is either ... Read More
![AmitDiwan](https://www.tutorialspoint.com/assets/profiles/123055/profile/60_187394-1565938756.jpg)
76 Views
To return a copy of an array with the trailing spaces removed, use the numpy.char.rstrip() method in Python Numpy.The numpy.char module provides a set of vectorized string operations for arrays of type numpy.str_ or numpy.bytes_.The chars parameter is a string specifying the set of characters to be removed. If omitted or None, the chars argument defaults to removing whitespace. The chars argument is not a suffix; rather, all combinations of its values are stripped.StepsAt first, import the required library −import numpy as npCreate a One-Dimensional array of string with some leading and trailing spaces −arr = np.array([' Tom ', ' ... Read More
![AmitDiwan](https://www.tutorialspoint.com/assets/profiles/123055/profile/60_187394-1565938756.jpg)
58 Views
To return a copy of an array with the leading characters removed, use the numpy.char.lstrip() method in Python Numpy. The "chars" parameter is used to set a string specifying the set of characters to be removed. If omitted or None, the chars argument defaults to removing whitespace. The chars argument is not a prefix; rather, all combinations of its values are stripped.The numpy.char module provides a set of vectorized string operations for arrays of type numpy.str_ or numpy.bytes_.The chars parameter is a string specifying the set of characters to be removed. If omitted or None, the chars argument defaults to ... Read More
![AmitDiwan](https://www.tutorialspoint.com/assets/profiles/123055/profile/60_187394-1565938756.jpg)
637 Views
To multiply each element of a masked Array by a scalar value in-place, use the ma.MaskedArray.__imul__() 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)
109 Views
To subtract a scalar value from each element of a masked Array in-place, use the ma.MaskedArray.__isub__() 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)
151 Views
To compute the bit-wise NOT of an array element-wise, use the numpy.bitwise_not() method in Python Numpy. Computes the bit-wise NOT of the underlying binary representation of the integers in the input arrays. This ufunc implements the C/Python operator ˜.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. Note that if an uninitialized out array is created via the default out=None, locations within it where the condition is False will remain uninitialized.StepsAt first, import ... Read More
![AmitDiwan](https://www.tutorialspoint.com/assets/profiles/123055/profile/60_187394-1565938756.jpg)
124 Views
To return a copy of an array with the leading spaces removed, use the numpy.char.lstrip() method in Python Numpy. The function returns an output array of str or unicode, depending on input type.The numpy.char module provides a set of vectorized string operations for arrays of type numpy.str_ or numpy.bytes_.The chars parameter is a string specifying the set of characters to be removed. If omitted or None, the chars argument defaults to removing whitespace. The chars argument is not a prefix; rather, all combinations of its values are stripped.StepsAt first, import the required library −import numpy as npCreate a One-Dimensional array ... Read More
![AmitDiwan](https://www.tutorialspoint.com/assets/profiles/123055/profile/60_187394-1565938756.jpg)
277 Views
To right-justify elements of an array and set the characters to use for padding, use the numpy.char.rjust() method in Python Numpy. The "width" parameter is the length of the resulting strings. The "fillchar" parameter is the character to use for padding.The function returns an output array of str or unicode, depending on input type. 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(['Tom', 'John', 'Kate', 'Amy', 'Brad']) Displaying our array −print("Array...", arr)Get the datatype −print("Array ... Read More