openpolicedata


Nameopenpolicedata JSON
Version 0.6 PyPI version JSON
download
home_page
SummaryThe 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.
upload_time2024-02-17 00:07:27
maintainer
docs_urlNone
author
requires_python>=3.8
licenseBSD 3-Clause License Copyright (c) 2021, sowdm All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
keywords police data use of force traffic stops complaints officer-involved shootings pandas arcgis socrata police transparency police accountability
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            [![PyPI version](https://badge.fury.io/py/openpolicedata.svg)](https://badge.fury.io/py/openpolicedata)
[![Streamlit App](https://static.streamlit.io/badges/streamlit_badge_black_white.svg)](https://openpolicedata.streamlit.app)

# OpenPoliceData
The 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 a [pandas DataFrame](https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.DataFrame.html). 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 openpolicedata
``` 

OpenPoliceData 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.](https://openpolicedata.readthedocs.io/en/stable/getting_started/index.html#Data-Standardization)

- Documentation: https://openpolicedata.readthedocs.io/
- Source Code: https://github.com/openpolicedata/openpolicedata
- Bug Tracker: https://github.com/openpolicedata/openpolicedata/issues
- [Latest Datasets](#latest-datasets-added)
- [Release Notes](#release-notes-for-version-057-2023-09-05)
- [Contributing](#contributing)


![alt text](https://github.com/openpolicedata/opd-data/blob/main/OPD_Datasets_Map.png?raw=true)

## Latest Datasets Added to OPD
- Chicago, IL: Traffic Citations
- Traffic Citations for agencies across New York State
- Buffalo Crashes and Incidents
- Massachusetts (All Agencies): Employee and Disciplinary Records data
- Alameda County, CA: Incidents
- Marin County, CA: Incidents
- Riverside, CA: Incidents
- Albany, NY: Arrests, Calls for Service, Field Contacts, Incidents, Traffic Citations, and Use of Force
- Chicago, IL: Pedestrian Stops
- New York City, NY: 2022 Pedestrian Stops
- Oakland, CA: 2022 Use of Force
- San Diego, CA: 2022 Complaints
- Tacoma, WA: Calls for Service, Complaints, Incidents, and Officer-Involved Shootings

## Release Notes for Version 0.6 - 2024-02-10
### Added
- Data standardization: Added function for standardizing some column names and data values
- Added reload function to datasets module to allow reloading the datasets table (in case of an update) or loading a datasets table from a custom location
- Added functions for getting race, gender, and age columns after standardization
- Added merge function for merging 2 table together
- Added function for finding related tables
- Added a function for expanding rows that contain information on multiple officers or subjects into multiple row
- Made opd.defs.TableType and opd.defs.columns available as opd.TableType and opd.Column
- Added Table.urls to enable quick retrieval of URLs associated with a dataset
- Added verbose mode to enable transparency when loading data with get_count, load_data_from_url, and load_from_url_gen
- Added Source.load_iter to be used instead of Source.load_from_url_gen
- Added Source.load to be used instead of Source.load_from_url
- Added data loader for CKAN API
### Changed
- Inputs 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.
### Deprecated
- Deprecated Source.load_from_url_gen. Will be removed in Version 1.0
- Deprecated Source.load_from_url. Will be removed in Version 1.0
### Removed
- Removed support for Python 3.7 which has reached end of life: https://www.python.org/downloads/release/python-370/
### Fixed
- Improved speed and feedback when reading large CSV files contained in zip files
- Source.get_agencies with a partial_name is now case-insensitive

Complete change log available at: https://github.com/openpolicedata/openpolicedata/blob/main/CHANGELOG.md

## Contributing
All contributions are welcome including code enhancments, bug fixes, bug reports, documentation updates, and locating new datasets. If you're interesting in helping out, see our [Contributing Guide](https://github.com/openpolicedata/openpolicedata/blob/main/CONTRIBUTING.MD) or reach out by [email](openpolicedata@gmail.com).

            

Raw data

            {
    "_id": null,
    "home_page": "",
    "name": "openpolicedata",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": "",
    "keywords": "police data,use of force,traffic,stops,complaints,officer-involved,shootings,pandas,arcgis,socrata,police transparency,police accountability",
    "author": "",
    "author_email": "Matt Sowd <openpolicedata@gmail.com>, Paul Otto <potto@ieee.org>",
    "download_url": "https://files.pythonhosted.org/packages/d8/33/7c14fc9be0ad9d25aaa1427a7736e51d63592669b0c0228176b40f905034/openpolicedata-0.6.tar.gz",
    "platform": null,
    "description": "[![PyPI version](https://badge.fury.io/py/openpolicedata.svg)](https://badge.fury.io/py/openpolicedata)\r\n[![Streamlit App](https://static.streamlit.io/badges/streamlit_badge_black_white.svg)](https://openpolicedata.streamlit.app)\r\n\r\n# OpenPoliceData\r\nThe 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. \r\n\r\nUsers request data by department name and type of data, and the data is returned as a [pandas DataFrame](https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.DataFrame.html). There is no need to manually find the data online or to know how to work with open data APIs (ArcGIS, Socrata, etc.).\r\n\r\nOpenPoliceData can be installed from the Python Package Index (PyPI):\r\n```\r\npip install openpolicedata\r\n``` \r\n\r\nOpenPoliceData provides access to police data with 2 simple lines of code:\r\n```\r\n> import openpolicedata as opd\r\n> src = opd.Source(\"New Orleans\")\r\n> data = src.load(table_type=\"USE OF FORCE\", year=2022)\r\n```\r\n\r\n> **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.](https://openpolicedata.readthedocs.io/en/stable/getting_started/index.html#Data-Standardization)\r\n\r\n- Documentation: https://openpolicedata.readthedocs.io/\r\n- Source Code: https://github.com/openpolicedata/openpolicedata\r\n- Bug Tracker: https://github.com/openpolicedata/openpolicedata/issues\r\n- [Latest Datasets](#latest-datasets-added)\r\n- [Release Notes](#release-notes-for-version-057-2023-09-05)\r\n- [Contributing](#contributing)\r\n\r\n\r\n![alt text](https://github.com/openpolicedata/opd-data/blob/main/OPD_Datasets_Map.png?raw=true)\r\n\r\n## Latest Datasets Added to OPD\r\n- Chicago, IL: Traffic Citations\r\n- Traffic Citations for agencies across New York State\r\n- Buffalo Crashes and Incidents\r\n- Massachusetts (All Agencies): Employee and Disciplinary Records data\r\n- Alameda County, CA: Incidents\r\n- Marin County, CA: Incidents\r\n- Riverside, CA: Incidents\r\n- Albany, NY: Arrests, Calls for Service, Field Contacts, Incidents, Traffic Citations, and Use of Force\r\n- Chicago, IL: Pedestrian Stops\r\n- New York City, NY: 2022 Pedestrian Stops\r\n- Oakland, CA: 2022 Use of Force\r\n- San Diego, CA: 2022 Complaints\r\n- Tacoma, WA: Calls for Service, Complaints, Incidents, and Officer-Involved Shootings\r\n\r\n## Release Notes for Version 0.6 - 2024-02-10\r\n### Added\r\n- Data standardization: Added function for standardizing some column names and data values\r\n- Added reload function to datasets module to allow reloading the datasets table (in case of an update) or loading a datasets table from a custom location\r\n- Added functions for getting race, gender, and age columns after standardization\r\n- Added merge function for merging 2 table together\r\n- Added function for finding related tables\r\n- Added a function for expanding rows that contain information on multiple officers or subjects into multiple row\r\n- Made opd.defs.TableType and opd.defs.columns available as opd.TableType and opd.Column\r\n- Added Table.urls to enable quick retrieval of URLs associated with a dataset\r\n- Added verbose mode to enable transparency when loading data with get_count, load_data_from_url, and load_from_url_gen\r\n- Added Source.load_iter to be used instead of Source.load_from_url_gen\r\n- Added Source.load to be used instead of Source.load_from_url\r\n- Added data loader for CKAN API\r\n### Changed\r\n- Inputs 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.\r\n### Deprecated\r\n- Deprecated Source.load_from_url_gen. Will be removed in Version 1.0\r\n- Deprecated Source.load_from_url. Will be removed in Version 1.0\r\n### Removed\r\n- Removed support for Python 3.7 which has reached end of life: https://www.python.org/downloads/release/python-370/\r\n### Fixed\r\n- Improved speed and feedback when reading large CSV files contained in zip files\r\n- Source.get_agencies with a partial_name is now case-insensitive\r\n\r\nComplete change log available at: https://github.com/openpolicedata/openpolicedata/blob/main/CHANGELOG.md\r\n\r\n## Contributing\r\nAll contributions are welcome including code enhancments, bug fixes, bug reports, documentation updates, and locating new datasets. If you're interesting in helping out, see our [Contributing Guide](https://github.com/openpolicedata/openpolicedata/blob/main/CONTRIBUTING.MD) or reach out by [email](openpolicedata@gmail.com).\r\n",
    "bugtrack_url": null,
    "license": "BSD 3-Clause License  Copyright (c) 2021, sowdm All rights reserved.  Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:  1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.  2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.  3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ",
    "summary": "The 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.",
    "version": "0.6",
    "project_urls": {
        "documentation": "https://openpolicedata.readthedocs.io/en/stable/documentation.html",
        "homepage": "https://openpolicedata.readthedocs.io/",
        "repository": "https://github.com/openpolicedata/openpolicedata",
        "tracker": "https://github.com/openpolicedata/openpolicedata/issues"
    },
    "split_keywords": [
        "police data",
        "use of force",
        "traffic",
        "stops",
        "complaints",
        "officer-involved",
        "shootings",
        "pandas",
        "arcgis",
        "socrata",
        "police transparency",
        "police accountability"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "5afdb1887eeb85026fc46b6edccd249ccd003715a74059cb84a29609768cf495",
                "md5": "27738b9e51373889eec0937fae9fcc36",
                "sha256": "5cfc44819fdf41e4b1820cf74f004378564775a873ac755b97eb9d5000a57807"
            },
            "downloads": -1,
            "filename": "openpolicedata-0.6-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "27738b9e51373889eec0937fae9fcc36",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8",
            "size": 99364,
            "upload_time": "2024-02-17T00:07:21",
            "upload_time_iso_8601": "2024-02-17T00:07:21.127642Z",
            "url": "https://files.pythonhosted.org/packages/5a/fd/b1887eeb85026fc46b6edccd249ccd003715a74059cb84a29609768cf495/openpolicedata-0.6-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "d8337c14fc9be0ad9d25aaa1427a7736e51d63592669b0c0228176b40f905034",
                "md5": "068ce5fa72eb7421b7df431fa1cd52d3",
                "sha256": "ad0522d3bd5de6fb872783bc628f7fb94fe60085e45ee9ece9a31bcc2f7909d5"
            },
            "downloads": -1,
            "filename": "openpolicedata-0.6.tar.gz",
            "has_sig": false,
            "md5_digest": "068ce5fa72eb7421b7df431fa1cd52d3",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 115366,
            "upload_time": "2024-02-17T00:07:27",
            "upload_time_iso_8601": "2024-02-17T00:07:27.007356Z",
            "url": "https://files.pythonhosted.org/packages/d8/33/7c14fc9be0ad9d25aaa1427a7736e51d63592669b0c0228176b40f905034/openpolicedata-0.6.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-02-17 00:07:27",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "openpolicedata",
    "github_project": "openpolicedata",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "requirements": [],
    "lcname": "openpolicedata"
}
        
Elapsed time: 0.19564s