toolsos 0.2.6__py3-none-any.whl → 0.2.7__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/geo.py +10 -5
- toolsos/huisstijl/maps/__init__.py +0 -0
- toolsos/huisstijl/tables/tables.py +13 -3
- {toolsos-0.2.6.dist-info → toolsos-0.2.7.dist-info}/METADATA +1 -1
- {toolsos-0.2.6.dist-info → toolsos-0.2.7.dist-info}/RECORD +7 -6
- {toolsos-0.2.6.dist-info → toolsos-0.2.7.dist-info}/WHEEL +0 -0
- {toolsos-0.2.6.dist-info → toolsos-0.2.7.dist-info}/top_level.txt +0 -0
toolsos/geo.py
CHANGED
|
@@ -17,15 +17,20 @@ def get_geo_json(
|
|
|
17
17
|
Returns:
|
|
18
18
|
dict[str, str]: geo json containg of the desired level and year
|
|
19
19
|
"""
|
|
20
|
-
base_url = "https://gitlab.com/os-amsterdam/datavisualisatie-onderzoek-en-statistiek/-/raw/main/public/geo
|
|
20
|
+
base_url = "https://gitlab.com/os-amsterdam/datavisualisatie-onderzoek-en-statistiek/-/raw/main/public/geo"
|
|
21
|
+
|
|
22
|
+
if level not in ["buurten", "wijken", "gebieden", "stadsdelen"]:
|
|
23
|
+
raise ValueError(
|
|
24
|
+
"level should be 'buurten', 'wijken', 'gebieden' or 'stadsdelen'"
|
|
25
|
+
)
|
|
21
26
|
|
|
22
27
|
if mra:
|
|
23
28
|
level = f"{level}-mra"
|
|
24
|
-
base_url = f"{base_url}mra
|
|
29
|
+
base_url = f"{base_url}/mra"
|
|
25
30
|
else:
|
|
26
|
-
base_url = f"{base_url}amsterdam
|
|
31
|
+
base_url = f"{base_url}/amsterdam"
|
|
27
32
|
|
|
28
|
-
if (year <= 2020)
|
|
33
|
+
if (year <= 2020) and not mra:
|
|
29
34
|
year = "2015-2020"
|
|
30
35
|
|
|
31
36
|
if with_water:
|
|
@@ -33,8 +38,8 @@ def get_geo_json(
|
|
|
33
38
|
else:
|
|
34
39
|
url = f"{base_url}/{year}/{level}-{year}-zw-geo.json"
|
|
35
40
|
|
|
36
|
-
print(url)
|
|
37
41
|
json = requests.get(url).json()
|
|
42
|
+
|
|
38
43
|
return json
|
|
39
44
|
|
|
40
45
|
|
|
File without changes
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import functools
|
|
2
2
|
import json
|
|
3
3
|
import re
|
|
4
|
+
import warnings
|
|
4
5
|
from itertools import groupby
|
|
5
6
|
from typing import Any, Callable, Dict
|
|
6
7
|
|
|
@@ -502,7 +503,8 @@ def write_table(
|
|
|
502
503
|
blue_border: bool | None = True,
|
|
503
504
|
blue_border_row_ids: int | list[int] | None = None,
|
|
504
505
|
number_format: str = "0.0",
|
|
505
|
-
autofit_columns: str | None =
|
|
506
|
+
autofit_columns: str | None = None,
|
|
507
|
+
column_widths: list[int] | None = None,
|
|
506
508
|
min_column_width: int | None = None,
|
|
507
509
|
col_filter: bool | None = False,
|
|
508
510
|
style: str = "old",
|
|
@@ -542,6 +544,7 @@ def write_table(
|
|
|
542
544
|
blue_border_row_ids=blue_border_row_ids,
|
|
543
545
|
number_format=number_format,
|
|
544
546
|
autofit_columns=autofit_columns,
|
|
547
|
+
column_widths=column_widths,
|
|
545
548
|
min_column_width=min_column_width,
|
|
546
549
|
col_filter=col_filter,
|
|
547
550
|
combine_multiindex=combine_multiindex,
|
|
@@ -590,7 +593,8 @@ def format_worksheet(
|
|
|
590
593
|
blue_border: bool | None = True,
|
|
591
594
|
blue_border_row_ids: int | list[int] | None = None,
|
|
592
595
|
number_format: str = "0.0",
|
|
593
|
-
autofit_columns: str | None =
|
|
596
|
+
autofit_columns: str | None = None,
|
|
597
|
+
column_widths: list[int] | None = None,
|
|
594
598
|
min_column_width: int | None = None,
|
|
595
599
|
col_filter: bool | None = False,
|
|
596
600
|
combine_multiindex: bool | int = False,
|
|
@@ -692,7 +696,13 @@ def format_worksheet(
|
|
|
692
696
|
if combine_multiindex:
|
|
693
697
|
cells_to_merge = get_cells_to_merge(df)
|
|
694
698
|
|
|
695
|
-
if
|
|
699
|
+
if column_widths:
|
|
700
|
+
if len(arr[0]) != len(column_widths):
|
|
701
|
+
raise Warning(
|
|
702
|
+
"The number of widths defined in column_widths should be equal to the number of columsn in the dataframe"
|
|
703
|
+
)
|
|
704
|
+
col_widths = column_widths
|
|
705
|
+
elif (autofit_columns == "column_names") or (autofit_columns is None):
|
|
696
706
|
col_widths = get_max_col_widths(df)
|
|
697
707
|
elif autofit_columns == "all_data":
|
|
698
708
|
col_widths = get_max_col_widths(arr)
|
|
@@ -2,7 +2,7 @@ toolsos/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
|
2
2
|
toolsos/cbs_tools.py,sha256=361cogk0aIU4D4BKHaa7YSOBh64t5C3zrHlqtWx0iIc,3465
|
|
3
3
|
toolsos/create_tables.py,sha256=43FHK3EERjumBtnGhngIdtthZzcc_Qi37lJ1MgATzBg,908
|
|
4
4
|
toolsos/download.py,sha256=88hehmPL5m5d1nrcJjltuh4xrCItF5EYHaZdHOcSt-g,2652
|
|
5
|
-
toolsos/geo.py,sha256=
|
|
5
|
+
toolsos/geo.py,sha256=w0Bt0JJEILEjKtmKw97rHkVixkgbATS-uAQUV6WCHfQ,2598
|
|
6
6
|
toolsos/helpers.py,sha256=VeOl-fLgePCbjEmAQdVmYe7z8OE1pISeDDuP1t5QSxM,997
|
|
7
7
|
toolsos/polars_helpers.py,sha256=P3RHLQFeDL7-9U_Q1n4ma_NSkdYAiker4pnc57uluHw,770
|
|
8
8
|
toolsos/database/database_connection.py,sha256=HCP8H_-iE2BOOQDp9v1HOgfUSX45XS-aqw7Nzf8drAU,4359
|
|
@@ -15,11 +15,12 @@ toolsos/huisstijl/graphs/graph_styles.py,sha256=Z9LLH7j8ODTsYMYK0rslacphuiRDcq5_
|
|
|
15
15
|
toolsos/huisstijl/graphs/linegraph.py,sha256=dMUarRe31SXaY78OCXLy-PgnU8LlVJ9KkzKaHhDtuuI,698
|
|
16
16
|
toolsos/huisstijl/graphs/piegraph.py,sha256=aEFiEM-9QuhBOjKHSXVuE5bTh-8uucq4FP6O8Vk1vZI,703
|
|
17
17
|
toolsos/huisstijl/graphs/styler.py,sha256=-uZ7pjY1G39XvmaGHQd31gPRxjxmJGhYZk8xhy2JUWc,6623
|
|
18
|
+
toolsos/huisstijl/maps/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
18
19
|
toolsos/huisstijl/tables/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
19
20
|
toolsos/huisstijl/tables/table_helpers.py,sha256=jsQ6lw93sxtGJGrUn8X2_LyA2vYYnytngpUI5A_wpWQ,2037
|
|
20
21
|
toolsos/huisstijl/tables/table_styles.py,sha256=oYU6GJcfqlKpZof5PUjPsA7woJ3Tew78CHPyT0_jY6w,1343
|
|
21
|
-
toolsos/huisstijl/tables/tables.py,sha256=
|
|
22
|
-
toolsos-0.2.
|
|
23
|
-
toolsos-0.2.
|
|
24
|
-
toolsos-0.2.
|
|
25
|
-
toolsos-0.2.
|
|
22
|
+
toolsos/huisstijl/tables/tables.py,sha256=w_8_KJhKDOxaLHouOYRG0pupgEqxy0qtty1DWD3rYc0,24488
|
|
23
|
+
toolsos-0.2.7.dist-info/METADATA,sha256=CzVk1Oi9ZEDuXdIEVssMaX8sAL-d77ij8qz2o1BwmgM,2683
|
|
24
|
+
toolsos-0.2.7.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
|
|
25
|
+
toolsos-0.2.7.dist-info/top_level.txt,sha256=2ClEjUBbtfDQ8oPwvWRy1Sz2nrkLCXlg0mHaMdCWia0,8
|
|
26
|
+
toolsos-0.2.7.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|