Yes, there is. This functionality is essentially a SQL SELECT ... WHERE ...
clause. There are lots of ways to achieve this, essentially depending on how performant you want it to be, what you want to install, and what you want to learn about. It is certainly not unique to Esri.
Personally, I'd take the shapefile, import it into PostgreSQL/PostGIS (and be very loath to go back), and then use SQLAlchemy/GeoAlchemy if I wanted to work in Python, but that's probably overkill. Look at SQLite/SpatiaLite. Both of these options will be fast with appropriate attribute indexing, and you can also do selection based on spatial attributes.
If you just want to work with existing shapefiles and not worry about a database, there is the pyshp that offers read and write support for shapefiles in Python. There are various tutorials online for pyshp
. You will essentially want to iterate through features and check if each feature's attributes match a Boolean condition (e.g. population > 5000
).
ogr2ogr -f "ESRI Shapefile" -sql "SELECT * from input_data WHERE attribute='value'" output_data.shp input_data.shp
. You can do the same with GDAL Python bindings.