Tutorials

https://vvcestudio.com.br/en/tutorial/python/numpy/
menu

NumPy

What is NumPy ?

It is a Library for working with matrices and vectors.NumPy is a package for the Python language that supports arrays and multidimensional matrices, having a wide collection of mathematical functions to work with these structures.

Limitation of NumPy

Variables must have data of the same type.
And hence the need to use Pandas.

Example code with Numpy
x
## Python comum
L = range(1000)
%timeit [i** 2 for i in L] ## Mostrar o tempo que demorou para processar

# Com Numpy
import numpy as np
a = np.arange(1000)
%timeit a** 2 ## Mostrar o tempo que demorou para processar
Calculations with arrays
x
# Criar arrys com Numpy
dados01 = np.array([1,2,3,4,5,6,7,8,9])
dados02 = np.array([7,4,3,2,4,5,6,7,8])

# Somar 2 arrays
soma = dados01 + dados02
print(soma)

# Multiplicar 2 arrays
multiplicar = dados01 + dados02
print(multiplicar)

# Médias
media = dados01.mean()
print(media)

# desvio padrão
DesvioPadrão = dados01.std()
print(DesvioPadrão)

#Valor máximo
dados01.max()

#Valor minimo
dados01.mini()
Logo NumPy