User Tools

Site Tools


appunti3s:numpy

This is an old revision of the document!


indice < linguaggio_python

numpy

https://numpy.org/doc/stable/

Il python (classico) dispone di oggetti array.array (monodimensionali)

numpy permette di usare un nuovo tipo di array

 numpy.ndarray 

noti anche con il termine “array” (cosa che potrebbe causare confusione se non si usasse il nome del modulo numpy come prefisso)

Vediamo alcuni esempi per definire un array

import numpy as np
a = [[ 1., 0., 0.], [ 0., 1., 2.]]
b = np.array([1.2, 3.5, 5.1])
c = np.array( [ [1.0,2.0], [3.0,4.0] ], dtype=complex )
d = np.zeros((3, 4))
e = np.ones((3, 4))
appunti3s/numpy.1594245514.txt.gz · Last modified: 2020/07/08 23:58 by profpro