Screen Link: https://app.dataquest.io/m/290/boolean-indexing-with-numpy/8/assignment-using-boolean-arrays-continued
My Code: <’
Replace this line with your code
create a new column filled with 0
.
print(taxi.shape[0])
zeros = np.zeros([taxi.shape[0], 1])
print(zeros)
taxi_modified = np.concatenate([taxi, zeros], axis=1)
#print(taxi_modified)
What I expected to happen:
numpy.zeros has following definition. numpy.
zeros
( shape , dtype=float , order=‘C’ )
Return a new array of given shape and type, filled with zeros.
Parameters: shape : int or tuple of ints
Shape of the new array, e.g., (2, 3)
or 2
.
dtype : data-type, optional
The desired data-type for the array, e.g., numpy.int8
. Default is numpy.float64
.
order : {‘C’, ‘F’}, optional, default: ‘C’
Whether to store multi-dimensional data in row-major (C-style) or column-major (Fortran-style) order in memory.
Returns: out : ndarray
Array of zeros with the given shape, dtype, and order.
What actually happened:
I am not sure what second parameter “1” means in below code
zeros = np.zeros([taxi.shape[0], 1])
Which parameter does it represent?
Replace this line with the output/error