 
 Data Structure Data Structure
 Networking Networking
 RDBMS RDBMS
 Operating System Operating System
 Java Java
 MS Excel MS Excel
 iOS iOS
 HTML HTML
 CSS CSS
 Android Android
 Python Python
 C Programming C Programming
 C++ C++
 C# C#
 MongoDB MongoDB
 MySQL MySQL
 Javascript Javascript
 PHP PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Numpy Articles - Page 81 of 121
 
 
			
			182 Views
To create a recarray from a list of records in text form, use the numpy.core.records.fromrecords() method in Python Numpy. The names is set using the "names" parameter. The field names, either specified as a comma-separated string in the form 'col1, col2, col3', or as a list or tuple of strings in the form ['col1', 'col2', 'col3']. An empty list can be used, in that case default field names (‘f0’, ‘f1’, …) are used.The first parameter is the data in the same field may be heterogeneous - they will be promoted to the highest data type. The dtype is the valid ... Read More
 
 
			
			139 Views
To create a recarray from a list of records in text form, use the numpy.core.records.fromrecords() method in Python Numpy. The names is set using the "names" parameter. The field names, either specified as a comma-separated string in the form 'col1, col2, col3', or as a list or tuple of strings in the form ['col1', 'col2', 'col3']. An empty list can be used, in that case default field names (‘f0’, ‘f1’, …) are used.The first parameter is the data in the same field may be heterogeneous - they will be promoted to the highest data type. The dtype is the valid ... Read More
 
 
			
			200 Views
To display the numpy record array, use the numpy.core.records.array() method in Python Numpy. The 1st parameter is the obj i.e. the input. If obj is None, then call the recarray constructor. If obj is a string, then call the fromstring constructor. If obj is a list or a tuple, then if the first object is an ndarray, call fromarrays, otherwise call fromrecords. If obj is a recarray, then make a copy of the data in the recarray (if copy=True) and use the new formats, names, and titles. If obj is a file, then call fromfile. Finally, if obj is an ... Read More
 
 
			
			458 Views
To construct an array by executing a function over each coordinate, use the numpy.fromfunction() method in Python Numpy. The function is called with N parameters, where N is the rank of shape. Each parameter represents the coordinates of the array varying along a specific axis. For example, if shape were (2, 2), then the parameters would be array([[0, 0], [1, 1]]) and array([[0, 1], [0, 1]])The fromfunction() returns the result of the call to function is passed back directly. Therefore, the shape of fromfunction is completely determined by function. If function returns a scalar value, the shape of fromfunction would ... Read More
 
 
			
			250 Views
To return a full array with the same shape and type as a given array, use the numpy.full_like() method in Python Numpy. The 1st parameter here is the shape and data-type, define these same attributes of the returned array. The 2nd parameter is the fill value.The order overrides the memory layout of the result. ‘C’ means C-order, ‘F’ means F-order, ‘A’ means ‘F’ if a is Fortran contiguous, ‘C’ otherwise. ‘K’ means match the layout of a as closely as possible.The subok parameter, if True, then the newly created array will use the sub-class type of a, otherwise it will ... Read More
 
 
			
			2K+ Views
To return a new array of given shape and type, filled with a fill value, use the numpy.full() method in Python Numpy. The 1st parameter is the shape of the new array. The 2nd parameter sets the fill value. The 3rd parameter is used to set the desired data-type of the returned output array.The dtype is the desired data-type for the array. The order suggests whether to store multidimensional data in C- or Fortran-contiguous (row- or column-wise) order in memory.NumPy offers comprehensive mathematical functions, random number generators, linear algebra routines, Fourier transforms, and more. It supports a wide range of ... Read More
 
 
			
			223 Views
To return the lower triangle of an array, use the numpy.tril() method in Python Numpy. The 1st parameter is the input array. The function returns a copy of an array with elements above the k-th diagonal zeroed. For arrays with ndim exceeding 2, tril will apply to the final two axes.The k is the diagonal above which to zero elements. k = 0 (the default) is the main diagonal, k < 0 is below it and k > 0 is above.StepsAt first, import the required library −import numpy as npCreate a 2d array −arr = np.array([[36, 36, 78, 88], [92, ... Read More
 
 
			
			2K+ Views
To create an array with zero above the main diagonal forming a lower triangular matrix, use the numpy.tri() method in Python Numpy. The 1st parameter is the number of rows in the array. The 2nd parameter is the number of columns in the array.The tri() function returns an array with its lower triangle filled with ones and zero elsewhere; in other words T[i,j] == 1 for j
 
 
			
			239 Views
To create an array with ones below the main diagonal and zeros elsewhere, use the numpy.tri() method in Python NumpyThe 1st parameter is the number of rows in the arrayThe 2nd parameter is the number of columns in the arrayThe 3rd parameter 'k' is the sub-diagonal at and below which the array is filled.The k = 0 is the main diagonal, while k < 0 is below it, and k > 0 is above. The default is 0. The tri() function returns an array with its lower triangle filled with ones and zero elsewhere; in other words T[i, j] == ... Read More
 
 
			
			717 Views
To create an array with ones above the main diagonal and zeros elsewhere, use the numpy.tri() method in Python NumpyThe 1st parameter is the number of rows in the arrayThe 2nd parameter is the number of columns in the arrayThe 3rd parameter 'k' is the sub-diagonal at and below which the array is filled.The k = 0 is the main diagonal, while k < 0 is below it, and k > 0 is above. The default is 0. The tri() function returns an array with its lower triangle filled with ones and zero elsewhere; in other words T[i, j] == ... Read More