ComeçarComece de graça

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 exercício faz parte do curso

Python for R Users

Ver curso

Exercício interativo prático

Experimente este exercício completando este código de exemplo.

# Import the numpy library using the alias: np
____ ____ ____ ____
Editar e executar o código