NumPy Interview Questions (Exercises)
Question-1: Import NumPy, check NumPy version and configurations: Solution: Question-2: Create a 1-D array of size 5, type float, and find the memory size(in bytes) of the array: Solution: Question-3:
Question-1: Import NumPy, check NumPy version and configurations: Solution: Question-2: Create a 1-D array of size 5, type float, and find the memory size(in bytes) of the array: Solution: Question-3:
Broadcasting in Numpy refers to the functionality provided by NumPy to carry out arithmetic operations on ndarrays having different dimensions. The arithmetic operations on arrays are normally done on corresponding
A Set is a collection of well-defined and distinct elements. Sets are one of the fundamental concepts in mathematics. The NumPy package provides the following functions to perform set operations on the array.
The NumPy package provides functions for reading and writing the arrays as text files as well as in a simple numpy binary format(.npy). loadtxt() and savetxt(): The loadtxt() function of
A random number is a number from a sequence or a distribution, whose future occurrence cannot be predicted based on any past or present data over a defined interval or
Table of Contents Show / Hide 1. Sorting functions1.1. sort():1.2. argsort():1.3. lexsort():1.4. sort_complex():2. Searching functions2.5. argmax():2.6. argmin():2.7. where():2.8. extract(): Sorting functions The NumPy package provides various functions to perform sorting
The NumPy package provides several functionalities to perform statistical operations on the array elements. amin() amax() nanmin() nanmax() ptp() percentile() nanpercentile() quantile() nanquantile() median() average() mean() std() var() nanmean() nanmedian()
Table of Contents Show / Hide 1. String Operations1.1. add():1.2. multiply():1.3. center():1.4. CaSe Handling:1.5. join():1.6. partition():1.7. replace():1.8. split():1.9. strip(), rstrip() and lstrip():1.10. zfill():1.11. encode() and decode():2. String Comparisons2.12. compare_chararrays():3. String
Table of Contents Show / Hide 1. Linear Algebra functions1.1. dot():1.2. multi_dot():1.3. vdot():1.4. inner():1.5. outer():1.6. matmul():1.7. matrix_power():1.8. eig():1.9. eigh():1.10. det():1.11. matrix_rank():1.12. trace():1.13. solve():1.14. inv():2. Matrix functions2.15. mat():2.16. eye():2.17. identity():2.18. repmat():2.19.
Table of Contents Show / Hide 1. Rounding functions:1.1. around():1.2. rint():1.3. fix():1.4. floor():1.5. ceil():1.6. trunc():2. Some commonly used functions:2.7. sum():2.8. prod():2.9. cumsum():2.10. cumprod():2.11. fmax():2.12. fmin():2.13. lcm():2.14. gcd():2.15. square():2.16. sqrt():2.17. cbrt():2.18.
Table of Contents Show / Hide 1. Trigonometric Functions:1.1. sin():1.2. cos():1.3. tan():1.4. arcsin():1.5. arccos():1.6. arctan():1.7. hypot():1.8. degrees():1.9. radians():2. Hyperbolic Functions:2.10. sinh():2.11. cosh():2.12. tanh():2.13. arcsinh():2.14. arccosh():2.15. arctanh(): Trigonometric Functions: The trigonometric
The NumPy package has several dedicated classes and modules to provide mathematical functions and operations for numpy arrays. Table of Contents Show / Hide 1. Arithmetic operations:1.1. add(), subtract(), multiply()
NumPy package provides several functions for the manipulation of the array and its elements. These functions can be classified broadly as: Changing Array Shapes Tranpose Operations Changing Array Dimensions Joining
The elements of a NumPy ndarray can be accessed and modified by indexing and slicing similar to Python’s in-built data structures. Table of Contents Show / Hide 1. Indexing1.0.1. Accessing
The NumPy package has a lot of functionalities for array creation. One of which is array() function which we discussed earlier in depth. Now we check out other ways to
In this article, we will see the functions that use numerical ranges to create a NumPy ndarray. arange() function linspace() function logspace() function Table of Contents Show / Hide 1.
The NumPy library supports ndarray creation using existing data as well. The following are the list of functions that creates ndarray from an existing data source: asarray() function frombuffer() function
The Numpy package provides attributes for the numpy arrays. These attributes help us to know the shape, dimension, and other properties of a given numpy array(ndarray). Table of Contents Show
The most important class defined in NumPy is an N-dimensional array type called ndarray. The ndarray class contains the data structures for representing the multi-dimensional arrays of homogeneous data (all
Numerical Python(NumPy) is a Python library that is fundamentally used for scientific computing in Python. The library provides fast operations on arrays, handling multidimensional arrays(example: matrices) and providing functions for