import numpy
#it will compare the second value toeach element in the vector
# If the values are equal, the Python interpreter returns True; otherwise, it returns False
vector = numpy.array([5, 10, 15, 20])
vector == 10
#Compares vector to the value 10, which generates a new Boolean vector [False, True, False, False]. It assigns this resultto equal_to_ten
vector = numpy.array([5, 10, 15, 20])
equal_to_ten = (vector == 10)
print equal_to_ten
print(vector[equal_to_ten])
#We can convert the data typeof an arraywith the ndarray.astype() method.
vector = numpy.array(["1", "2", "3"])printvector.dtypeprintvectorvector = vector.astype(float)printvector.dtypeprintvector
# The axis dictates which dimension we perform the operation on#1 means that we want to perform the operation oneach row, and0 means oneach column
matrix = numpy.array([
[5, 10, 15],
[20, 25, 30],
[35, 40, 45]
])
matrix.sum(axis=1)