ComenzarEmpieza gratis

NumPy arrays

Vectors and matrices are not available in core Python. In order to use them, you will have to import the NumPy library. Just as how you used dot notation to access methods of an object, you can use the dot notation to access functions from a library. Recall that you can import a library using an alias. For example, to import package as pk, you can use:

import package as pk

Within the numpy library, you can use the loadtxt() function to import files. For example, you can load a file named data.csv using numpy with numpy.loadtxt('data.csv'). The loadtxt() function has a delimiter parameter which lets you specify that your data is separated by commas.

Este ejercicio forma parte del curso

Python for R Users

Ver curso

Ejercicio interactivo práctico

Prueba este ejercicio completando el código de muestra.

# Import the numpy library using the alias: np
____ ____ ____ ____
Editar y ejecutar código