Numpy Program Examples
Python
import numpy as np # Create two NumPy arrays array1 = np.array([ 1 , 2 , 3 ]) array2 = np.array([ 4 , 5 , 6 ]) # Perform element-wise addition result_addition = array1 + array2 # Display the original arrays and the results print ( "Array 1:" , array1) print ( "Array 2:" , array2) print ( "Element-wise Addition:" , result_addition) |
Also Practice, Important Numpy programs
- Python | Check whether a list is empty or not
- Python | Get unique values from a list
- Python | Multiply all numbers in the list (3 different ways)
- Transpose a matrix in Single line in Python
- Multiplication of two Matrices in Single line using Numpy in Python
- Python program to print checkerboard pattern of nxn using numpy
- Graph Plotting in Python | Set 1, Set 2, Set 3
NumPy Tutorial – Python Library
NumPy is a general-purpose array-processing Python library which provides handy methods/functions for working n-dimensional arrays. NumPy is a short form for “Numerical Python“. It provides various computing tools such as comprehensive mathematical functions, and linear algebra routines.
- NumPy provides both the flexibility of Python and the speed of well-optimized compiled C code.
- Its easy-to-use syntax makes it highly accessible and productive for programmers from any background.
This NumPy tutorial helps you learn the fundamentals of NumPy from Basics to Advanced, like operations on NumPy array, creating and plotting random data sets, and working with NumPy functions.