'How to exclude rows base on a value range ? Python

I have a dataset of 9636 rows in which I want to exclude the zipcodes ('zip') that are not from PA (range 15001 to 19611). I try to do this but it seems that it deleted all the columns. i want to keep all the columns with zip codes within this range (range 15001 to 196110)

Code

pa_zip = (CSR_data['zip'] >= 15001 ) & (CSR_data['zip']<= 19611)
pa_zip


Solution 1:[1]

pa_zip = CSR_data[(CSR_data['zip'] >= 15001 ) & (CSR_data['zip']<= 19611)]
pa_zip

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 NANDHA KUMAR