toolsos 0.1__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
toolsos/tabellen.py ADDED
@@ -0,0 +1,30 @@
1
+ from __future__ import annotations
2
+
3
+ import pandas as pd
4
+
5
+
6
+ def custom_round(x: int, base: int = 10) -> int:
7
+ return int(base * round(float(x) / base))
8
+
9
+
10
+ def create_table(df: pd.DataFrame, cols: list[str]) -> pd.DataFrame:
11
+ tbl = df.groupby(cols).size().reset_index().rename(columns={0: "aantal"})
12
+ tbl["aantal"] = tbl["aantal"].apply(
13
+ custom_round
14
+ ) # Je kan hier nog '* 100' achter zetten als je het naar een percentage wil omzetten
15
+ tbl["grp_size"] = tbl.groupby(cols[:-1])["aantal"].transform("sum")
16
+ tbl["aandeel"] = tbl["aantal"] / tbl["grp_size"]
17
+
18
+ # Eventueel grp_size kolom weer droppen
19
+ # tbl = tbl.drop(columns="grp_size")
20
+
21
+ return tbl
22
+
23
+
24
+ def create_tables(
25
+ df: pd.DataFrame, tables: dict[str, list[str]]
26
+ ) -> dict[str, pd.DataFrame]:
27
+ rs = {}
28
+ for k, v in tables.items():
29
+ rs[k] = create_table(df, v)
30
+ return rs
@@ -0,0 +1,45 @@
1
+ Metadata-Version: 2.1
2
+ Name: toolsos
3
+ Version: 0.1
4
+ Summary: OS tools
5
+ Author-email: OS <d.schmitz@amsterdam.nl>
6
+ Keywords: feed,reader,tutorial
7
+ Classifier: License :: OSI Approved :: MIT License
8
+ Classifier: Programming Language :: Python
9
+ Classifier: Programming Language :: Python :: 3
10
+ Requires-Python: >=3.11
11
+ Description-Content-Type: text/markdown
12
+ Provides-Extra: all
13
+ Requires-Dist: keyring ; extra == 'all'
14
+ Requires-Dist: plotly ; extra == 'all'
15
+ Requires-Dist: openpyxl ; extra == 'all'
16
+ Requires-Dist: sqlalchemy ; extra == 'all'
17
+ Requires-Dist: pyyaml ; extra == 'all'
18
+ Requires-Dist: requests ; extra == 'all'
19
+ Provides-Extra: dev
20
+ Requires-Dist: black ; extra == 'dev'
21
+ Requires-Dist: bumpver ; extra == 'dev'
22
+ Requires-Dist: isort ; extra == 'dev'
23
+ Requires-Dist: pip-tools ; extra == 'dev'
24
+ Requires-Dist: pytest ; extra == 'dev'
25
+
26
+ # Tools Onderzoek & Statistiek
27
+
28
+ This repository contains the tools used by the data scientist/researchers working at Onderzoek & Statistiek
29
+
30
+ ## Installation instructions
31
+
32
+ The package can be installed using:
33
+ - pip
34
+ - Use pip install toolsos[all]
35
+ - conda.
36
+ - Use pip install toolsos. The user has to download the dependencies themselves
37
+
38
+ ## Building the package
39
+
40
+ Instructions on building a package can be found [here](https://packaging.python.org/en/latest/tutorials/packaging-projects/)
41
+
42
+ - py -m pip install --upgrade build
43
+ - py -m build
44
+
45
+ ## Uploading the package to PyPi
@@ -0,0 +1,23 @@
1
+ toolsos/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
2
+ toolsos/cbs_tools.py,sha256=VLhptzy7m5EaET07s6VeAfDz79g1Hs38qeWPyA14wkw,2823
3
+ toolsos/database_connection.py,sha256=BlHzLS17KzJP_7R5-IBd8WqgwAt-zDRwJXD4Jx6Tetw,3323
4
+ toolsos/database_transfer.py,sha256=1ghq5VEtKyOdCKdM45uOyrZSoXMuWsdC35R3WNuFvdU,1827
5
+ toolsos/download.py,sha256=88hehmPL5m5d1nrcJjltuh4xrCItF5EYHaZdHOcSt-g,2652
6
+ toolsos/geo.py,sha256=_OexkeUgXcnPW1mw27VN6fMcX2PMUSljLwIg48Xkv3M,2412
7
+ toolsos/helpers.py,sha256=VeOl-fLgePCbjEmAQdVmYe7z8OE1pISeDDuP1t5QSxM,997
8
+ toolsos/polars_helpers.py,sha256=P3RHLQFeDL7-9U_Q1n4ma_NSkdYAiker4pnc57uluHw,770
9
+ toolsos/tabellen.py,sha256=43FHK3EERjumBtnGhngIdtthZzcc_Qi37lJ1MgATzBg,908
10
+ toolsos/huisstijl/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
11
+ toolsos/huisstijl/colors.py,sha256=lSCHCdSjge5cGfLfAObd6mV6TaXq3QGImLOmoGJpGkw,1484
12
+ toolsos/huisstijl/graphs/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
13
+ toolsos/huisstijl/graphs/bargraph.py,sha256=-tPXpWfK5T6NPFrIpt2mc6XwxOV0bxJnOKT3Qqex0ro,2584
14
+ toolsos/huisstijl/graphs/linegraph.py,sha256=TP6sl3DhT0KEimcgcG5xXLm37wqVoT6dXMes32WMoew,399
15
+ toolsos/huisstijl/graphs/piegraph.py,sha256=y814kk2dnWmFsIoa3A2N0aFBnUYvuPDcFLibKd5Dvhc,573
16
+ toolsos/huisstijl/graphs/styler.py,sha256=XdgyNckQXbvNZmx3jj1EY9CLa8qIDtsVW3RXQcn0ktA,3317
17
+ toolsos/huisstijl/tables/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
18
+ toolsos/huisstijl/tables/table_styles.py,sha256=oYU6GJcfqlKpZof5PUjPsA7woJ3Tew78CHPyT0_jY6w,1343
19
+ toolsos/huisstijl/tables/tables.py,sha256=oUvbwdd12WnXLCLP-0eXizM0j4AlbVhNz4EWUocYNzM,17212
20
+ toolsos-0.1.dist-info/METADATA,sha256=QToxFvYjbtisylFY_R84L-814YXv_p7oGdcNpG4UgY4,1461
21
+ toolsos-0.1.dist-info/WHEEL,sha256=oiQVh_5PnQM0E3gPdiz09WCNmwiHDMaGer_elqB3coM,92
22
+ toolsos-0.1.dist-info/top_level.txt,sha256=2ClEjUBbtfDQ8oPwvWRy1Sz2nrkLCXlg0mHaMdCWia0,8
23
+ toolsos-0.1.dist-info/RECORD,,
@@ -0,0 +1,5 @@
1
+ Wheel-Version: 1.0
2
+ Generator: bdist_wheel (0.42.0)
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
5
+
@@ -0,0 +1 @@
1
+ toolsos