First page Back Continue Last page Overview Graphics

Importing NumPy and First Example

Usually, Numpy gets imported as „np“:

import numpy as np

a = np.array([0, 1, 2, 3])

print(a)

celsius_values = [25.3, 24.8, 26.9, 23.9]

C = np.array(celsius_values)

print(C)

# turn into Fahrenheit

print(C * 9 / 5 + 32)

[0 1 2 3]

[ 25.3 24.8 26.9 23.9]

[ 77.54 76.64 80.42 75.02]