A Python package for Korean census data processing
Project description
pycensuskr
A Python package template for Korean census data processing.
Installation
From source
git clone https://github.com/sigmafelix/pycensuskr.git
cd pycensuskr
pip install -e .
# python setup.py install
For development
git clone https://github.com/sigmafelix/pycensuskr.git
cd pycensuskr
pip install -e ".[dev]"
Usage
from pycensuskr import __version__
from pycensuskr import CensusKR
from matplotlib import pyplot as plt
import geopandas as gpd
# Print version
print(__version__)
# Create a CensusData instance
census = CensusKR()
# load specific year data
data_2020 = census.load_data(2020)
print(data_2020)
# load district boundaries for a specific year
districts_2020 = census.load_districts(2020)
districts_2020["adm2_re"] = districts_2020["adm2_code"].astype(str).str.slice(0,4)
# aggregate geometries by adm2_re
districts_2020 = districts_2020.dissolve(by="adm2_re", as_index=False)
districts_2020["adm2_code"] = districts_2020["adm2_re"] + "0"
districts_2020["adm2_code"] = districts_2020["adm2_code"].astype(int)
# cleaned data with variable types
df_tax_2020 = census.anycensus(year = 2020, type = "tax", aggregator = "sum")
districts_tax_2020 = districts_2020.merge(df_tax_2020, on="adm2_code")
print(districts_tax_2020)
districts_tax_2020.plot("income_labor_mil")
plt.show()
Development
Running tests
pytest
License
This project is licensed under the MIT License - see the LICENSE file for details.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pycensuskr-0.1.0.tar.gz.
File metadata
- Download URL: pycensuskr-0.1.0.tar.gz
- Upload date:
- Size: 6.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ffacd4feb631bf0780ee5d0e7f2a8b029ce7c1f9adc06123499c5ec798a95b5c
|
|
| MD5 |
80712678ecee00ca524a84f4e5b92583
|
|
| BLAKE2b-256 |
1318ce353e61d9cee3ae13732c614dc7a8231b5c49c2e1138ef4b52d3c6850a3
|
Provenance
The following attestation bundles were made for pycensuskr-0.1.0.tar.gz:
Publisher:
build-and-release.yml on sigmafelix/pycensuskr
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pycensuskr-0.1.0.tar.gz -
Subject digest:
ffacd4feb631bf0780ee5d0e7f2a8b029ce7c1f9adc06123499c5ec798a95b5c - Sigstore transparency entry: 641833906
- Sigstore integration time:
-
Permalink:
sigmafelix/pycensuskr@e28d8420cc04a089686051bbe2c784cc7e96e30d -
Branch / Tag:
refs/tags/v0.1.1 - Owner: https://github.com/sigmafelix
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
build-and-release.yml@e28d8420cc04a089686051bbe2c784cc7e96e30d -
Trigger Event:
push
-
Statement type:
File details
Details for the file pycensuskr-0.1.0-py3-none-any.whl.
File metadata
- Download URL: pycensuskr-0.1.0-py3-none-any.whl
- Upload date:
- Size: 6.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
941cfe5469a07d02c12080811bc71d23b613aa75afab2b98d5bbaa1404f3aba7
|
|
| MD5 |
21a74f48b1456e9dc30077258e4f5bed
|
|
| BLAKE2b-256 |
56254febb2f3497f8776d15792f58da2ca1cd189a36a8db4e7ec250622ebf48e
|
Provenance
The following attestation bundles were made for pycensuskr-0.1.0-py3-none-any.whl:
Publisher:
build-and-release.yml on sigmafelix/pycensuskr
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pycensuskr-0.1.0-py3-none-any.whl -
Subject digest:
941cfe5469a07d02c12080811bc71d23b613aa75afab2b98d5bbaa1404f3aba7 - Sigstore transparency entry: 641833921
- Sigstore integration time:
-
Permalink:
sigmafelix/pycensuskr@e28d8420cc04a089686051bbe2c784cc7e96e30d -
Branch / Tag:
refs/tags/v0.1.1 - Owner: https://github.com/sigmafelix
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
build-and-release.yml@e28d8420cc04a089686051bbe2c784cc7e96e30d -
Trigger Event:
push
-
Statement type: