Today is my 66th day of #100daysofcode and #python learning. Today also continue to learned from Datacamp including the topic histogram customization using matplotlib, DataFrame from dictionary using pandas, comparison operator, boolean Operators with numpy.
Here is the code for boolean operator with numpy.
We all are familiar with boolean operators with early days of school. Operators and, or, and not are known as boolean operator. In numpy we can use these operator as np.logical_and(), np.logical_or() and np.logical_not()
import numpy as np my_house = np.array([18.0, 20.0, 10.75, 9.50]) your_house = np.array([14.0, 24.0, 14.25, 9.0]) # my_house greater than 18.5 or smaller than 10 print(np.logical_or(my_house > 18.5, my_house < 10)) # Both my_house and your_house smaller than 11 print(np.logical_and(my_house < 11, your_house < 11))