Fellesfunksjoner for ssb i Python
Project description
SSB Fag-fellesfunksjoner i Python
A place for "loose, small functionality" produced at Statistics Norway in Python. Functionality might start here, if it is to be used widely within the organization, but later be moved to bigger packages if they "grow out of proportions".
Team: ssb-pythonistas
We are a team of statiticians which hope to curate and generalize functionality which arizes from specific needs in specific production-environments. We try to take responsibility for this functionality to be generalized and available to all of statistics Norway through this package.
Contributing
Please make contact with one of our team members, to see if you can join, or how to send in a PR for approval into the package.
Installing
poetry add ssb-fagfunksjoner
Usage
Check if you are on Dapla or in prodsone.
from fagfunksjoner import check_env
check_env()
Navigate to the root of your project and back again. Do stuff while in root, like importing local functions.
from fagfunksjoner import ProjectRoot
with ProjectRoot():
... # Do your local imports here...
Querying internal oracle-database "DB1P"
from fagfunksjoner import query_db1p
sporring = "SELECT SNR_NUDB FROM NUDB_ADM.TAB_UTD_PERSON"
df = query_db1p(sporring)
Setting up password with saspy
from fagfunksjoner.prodsone import saspy_ssb
saspy_ssb.set_password() # Follow the instructions to set the password
saspy_ssb.saspy_df_from_path("path")
Aggregate on all combinations of codes in certain columns (maybe before sending to statbank? Like proc means?)
from fagfunksjoner import all_combos_agg
ialt_koder = {
"skolefylk": "01-99",
"almyrk": "00",
"kjoenn_t": "0",
"sluttkomp": "00",
}
kolonner = list(ialt_koder.keys())
tab = all_combos_agg(vgogjen,
groupcols=kolonner,
aggargs={'antall': sum},
fillna_dict=ialt_koder)
Project details
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
Hashes for ssb_fagfunksjoner-0.0.8-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0597a6aa17868f55a9c15728f9eaf5ed37e8a9326461e7158c4fc1a280cd6d9e |
|
MD5 | 1c4b2f3f94cbeb4b42ce0bb30447bd0d |
|
BLAKE2b-256 | db197cf36b64ee2b7ea83ef8c2fde084e37449ac465679c87ea533ba39356bc8 |