Please enable JavaScript.
Coggle requires JavaScript to display documents.
ARREGLOS, VECTORES, SERIES Y DATAFRAMES - Coggle Diagram
ARREGLOS, VECTORES, SERIES Y DATAFRAMES
Para trabajar con arreglos utilizamos NumPy.
import numpy as np
Crear un arreglo
arr = np.array([10, 20, 30, 40, 50])
Arreglos n-dimensionales
Arreglo 2D
Arreglo 3D
Dimensiones y tamaño
Estas funciones son muy importantes:
arr.ndim
Indica el número de dimensiones.
arr.shape
Indica la forma del arreglo.
arr.size
Indica el número total de elementos.
Indexación
La indexación permite acceder a elementos específicos.
Índices negativos
print(arr[-1])
Slicing
Permite obtener una parte del arreglo.
Indexación en arreglos 2D
matriz = np.array([[10, 20, 30], [40, 50, 60] ])
Seleccionar filas y columnas
print(matriz[0, :])
Primera fila
Segunda fila
print(matriz[1, :])
Primera columna
print(matriz[:, 0])
Segunda columna
print(matriz[:, 1])