Junior — Middle
66
Mis on NumPy teek ja milleks seda Pythonis kasutatakse?
Vastus AI-lt
sobes.tech AI
NumPy is a library for the Python language that provides support for large multidimensional arrays and matrices, as well as a large number of high-level mathematical functions to work with them. It is used for efficient numerical computations, scientific analysis, and data processing.
Main advantages of NumPy:
- Fast operations on arrays thanks to its implementation in C.
- Convenient functions for linear algebra, statistics, Fourier transforms, and more.
- Foundation for many other libraries in data analysis and machine learning.
Example of usage:
import numpy as np
# Creating an array from a list
arr = np.array([1, 2, 3, 4])
# Multiplying by a number
arr2 = arr * 2
print(arr2) # [2 4 6 8]