Boolean indexing necessarily filters your dataset by removing all the rows that don't match the criteria. Instead of dropping all these values, it is possible to keep them using the where method. The where method preserves the size of your Series or DataFrame and either sets the values that don't meet the criteria to missing or replaces them with something else.
Preserving Series with the where method
Getting ready
In this recipe, we pass the where method boolean conditions to put a floor and ceiling on the minimum and maximum number of Facebook likes for actor 1 in the movie dataset.