Posts

Showing posts with the label Numpy

Python Numpy

 Python Numpy Important functions All() = Np.all  return  None of the element is zero. np.isreal() = Returns array is real or not np.isfinint() = Finiter or not np.iscomplex() = Complex or not np.isscalar() = Scalar or not np.greater(x,y) = Greater np.greater_equla() = Greater and equla , similerly for less np.zeros(no_0f_element) = create and 1d array zeros depending upon no of elements np.ones(no_of_element) = create and 1d array ones depending upon no of elements np.identity(size) = return the identity matrix of given size np.linspace(s,e,d) = it will return d no of equaliy distributed numbers between s and e np.diag(list of numbers) = set the list of numbers on the diagonal np.setdff1d(a,b) = return the unique elements from array a which are not in array b np.unique(a) = return all elemnents for array without repeating np.intersect1d(a,b) = return the intersaction of a,b similerly union np.in1d(a,b) = return that each element of array a in present in b or not np.nonze...

Python numpy fuctions

 Python numpy fuctions resource : w3resource.com Following are some important python numpy functions NumPy Basics Operator Description np.array([1,2,3]) 1d array np.array([(1,2,3),(4,5,6)]) 2d array np.arange(start,stop,step) range array Placeholders Operator Description np.linspace(0,2,9) Add evenly spaced values btw interval to array of length np.zeros((1,2)) Create and array filled with zeros np.ones((1,2)) Creates an array filled with ones np.random.random((5,5)) Creates random array np.empty((2,2)) Creates an empty array Array Syntax Description array.shape Dimensions (Rows,Columns) len(array) Length of Array array.ndim Number of Array Dimensions array.dtype Data Type array.astype(type) Converts to Data Type type(array) Type of Array Copying/Sorting Operators Description np.copy(array) Creates copy of array other = array.copy() Creates deep copy of array array.sort() Sorts an array array.sort(axis=0) Sorts axis of array Array Manipulation Adding or Removing Elements Operator D...