In [1]:
import numpy as np
print("ones", np.ones(5))
print("arange", np.arange(5))
print("linspace", np.linspace(0., 1., 5))
print("random", np.random.uniform(size=3))
print("custom", np.array([2, 3, 5]))
Out[1]:
In [2]:
np.array([[1, 2], [3, 4]])
Out[2]:
In [3]:
np.ones(5, dtype=np.int64)
Out[3]:
In [4]:
np.arange(5).astype(np.float64)
Out[4]:
In [5]:
import pandas as pd
In [6]:
data = pd.read_csv('../chapter2/data/nyc_data.csv')
In [7]:
pickup = data[['pickup_longitude', 'pickup_latitude']].values
pickup
Out[7]:
In [8]:
pickup.shape
Out[8]: