What is the dtype of np.array([1, 2]) + 0.5?
Correct answer
B. float64
18 views
B. float64
18 views
NumPy upcasts to a type that can hold all results, so adding a float to integers produces float64: array([1.5, 2.5]).
Asked in: Data Science Interviews
Not sure why the answer is B? Ask here and get an explanation.