Package: openpolicedata
OpenPoliceDataThe OpenPoliceData (OPD) Python library is the most comprehensive centralized public access point for incident-level police data in the United States. OPD provides easy access to 395+ incident-level datasets for about 4800 police agencies. Types of data include traffic stops, use of force, officer-involved shootings, and complaints.Users request data by department name and type of data, and the data is returned as apandas DataFrame. There is no need to manually find the data online or to know how to work with open data APIs (ArcGIS, Socrata, etc.).OpenPoliceData can be installed from the Python Package Index (PyPI):pip install openpolicedataOpenPoliceData provides access to police data with 2 simple lines of code:> import openpolicedata as opd
> src = opd.Source("New Orleans")
> data = src.load(table_type="USE OF FORCE", year=2022)NEW IN VERSION 0.6: OPD now provides tools for automated data standardization. Applying these tools allow you to start your analysis more quickly by replacing column names and data with standard values for some common column types.Learn how it works and how to use it here.Documentation:https://openpolicedata.readthedocs.io/Source Code:https://github.com/openpolicedata/openpolicedataBug Tracker:https://github.com/openpolicedata/openpolicedata/issuesLatest DatasetsRelease NotesContributingLatest Datasets Added to OPDChicago, IL: Traffic CitationsTraffic Citations for agencies across New York StateBuffalo Crashes and IncidentsMassachusetts (All Agencies): Employee and Disciplinary Records dataAlameda County, CA: IncidentsMarin County, CA: IncidentsRiverside, CA: IncidentsAlbany, NY: Arrests, Calls for Service, Field Contacts, Incidents, Traffic Citations, and Use of ForceChicago, IL: Pedestrian StopsNew York City, NY: 2022 Pedestrian StopsOakland, CA: 2022 Use of ForceSan Diego, CA: 2022 ComplaintsTacoma, WA: Calls for Service, Complaints, Incidents, and Officer-Involved ShootingsRelease Notes for Version 0.6 - 2024-02-10AddedData standardization: Added function for standardizing some column names and data valuesAdded reload function to datasets module to allow reloading the datasets table (in case of an update) or loading a datasets table from a custom locationAdded functions for getting race, gender, and age columns after standardizationAdded merge function for merging 2 table togetherAdded function for finding related tablesAdded a function for expanding rows that contain information on multiple officers or subjects into multiple rowMade opd.defs.TableType and opd.defs.columns available as opd.TableType and opd.ColumnAdded Table.urls to enable quick retrieval of URLs associated with a datasetAdded verbose mode to enable transparency when loading data with get_count, load_data_from_url, and load_from_url_genAdded Source.load_iter to be used instead of Source.load_from_url_genAdded Source.load to be used instead of Source.load_from_urlAdded data loader for CKAN APIChangedInputs to Source.get_count is now (table_type, year, ...) instead of (year, table_type, ...) so inputs go from general to specific. Original input order is deprecated and will be removed in Version 1.0.DeprecatedDeprecated Source.load_from_url_gen. Will be removed in Version 1.0Deprecated Source.load_from_url. Will be removed in Version 1.0RemovedRemoved support for Python 3.7 which has reached end of life:https://www.python.org/downloads/release/python-370/FixedImproved speed and feedback when reading large CSV files contained in zip filesSource.get_agencies with a partial_name is now case-insensitiveComplete change log available at:https://github.com/openpolicedata/openpolicedata/blob/main/CHANGELOG.mdContributingAll contributions are welcome including code enhancments, bug fixes, bug reports, documentation updates, and locating new datasets. If you're interesting in helping out, see ourContributing Guideor reach out byemail.