toolsos 0.2.7__tar.gz → 0.2.8__tar.gz

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.
Files changed (31) hide show
  1. {toolsos-0.2.7 → toolsos-0.2.8}/PKG-INFO +1 -1
  2. {toolsos-0.2.7 → toolsos-0.2.8}/pyproject.toml +1 -1
  3. {toolsos-0.2.7 → toolsos-0.2.8}/src/toolsos/geo.py +9 -0
  4. {toolsos-0.2.7 → toolsos-0.2.8}/src/toolsos/huisstijl/tables/tables.py +9 -1
  5. {toolsos-0.2.7 → toolsos-0.2.8}/src/toolsos.egg-info/PKG-INFO +1 -1
  6. {toolsos-0.2.7 → toolsos-0.2.8}/README.md +0 -0
  7. {toolsos-0.2.7 → toolsos-0.2.8}/setup.cfg +0 -0
  8. {toolsos-0.2.7 → toolsos-0.2.8}/src/toolsos/__init__.py +0 -0
  9. {toolsos-0.2.7 → toolsos-0.2.8}/src/toolsos/cbs_tools.py +0 -0
  10. {toolsos-0.2.7 → toolsos-0.2.8}/src/toolsos/create_tables.py +0 -0
  11. {toolsos-0.2.7 → toolsos-0.2.8}/src/toolsos/database/database_connection.py +0 -0
  12. {toolsos-0.2.7 → toolsos-0.2.8}/src/toolsos/database/database_transfer.py +0 -0
  13. {toolsos-0.2.7 → toolsos-0.2.8}/src/toolsos/download.py +0 -0
  14. {toolsos-0.2.7 → toolsos-0.2.8}/src/toolsos/helpers.py +0 -0
  15. {toolsos-0.2.7 → toolsos-0.2.8}/src/toolsos/huisstijl/__init__.py +0 -0
  16. {toolsos-0.2.7 → toolsos-0.2.8}/src/toolsos/huisstijl/colors.py +0 -0
  17. {toolsos-0.2.7 → toolsos-0.2.8}/src/toolsos/huisstijl/graphs/__init__.py +0 -0
  18. {toolsos-0.2.7 → toolsos-0.2.8}/src/toolsos/huisstijl/graphs/bargraph.py +0 -0
  19. {toolsos-0.2.7 → toolsos-0.2.8}/src/toolsos/huisstijl/graphs/graph_styles.py +0 -0
  20. {toolsos-0.2.7 → toolsos-0.2.8}/src/toolsos/huisstijl/graphs/linegraph.py +0 -0
  21. {toolsos-0.2.7 → toolsos-0.2.8}/src/toolsos/huisstijl/graphs/piegraph.py +0 -0
  22. {toolsos-0.2.7 → toolsos-0.2.8}/src/toolsos/huisstijl/graphs/styler.py +0 -0
  23. {toolsos-0.2.7 → toolsos-0.2.8}/src/toolsos/huisstijl/maps/__init__.py +0 -0
  24. {toolsos-0.2.7 → toolsos-0.2.8}/src/toolsos/huisstijl/tables/__init__.py +0 -0
  25. {toolsos-0.2.7 → toolsos-0.2.8}/src/toolsos/huisstijl/tables/table_helpers.py +0 -0
  26. {toolsos-0.2.7 → toolsos-0.2.8}/src/toolsos/huisstijl/tables/table_styles.py +0 -0
  27. {toolsos-0.2.7 → toolsos-0.2.8}/src/toolsos/polars_helpers.py +0 -0
  28. {toolsos-0.2.7 → toolsos-0.2.8}/src/toolsos.egg-info/SOURCES.txt +0 -0
  29. {toolsos-0.2.7 → toolsos-0.2.8}/src/toolsos.egg-info/dependency_links.txt +0 -0
  30. {toolsos-0.2.7 → toolsos-0.2.8}/src/toolsos.egg-info/requires.txt +0 -0
  31. {toolsos-0.2.7 → toolsos-0.2.8}/src/toolsos.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: toolsos
3
- Version: 0.2.7
3
+ Version: 0.2.8
4
4
  Summary: OS tools
5
5
  Author-email: OS <d.schmitz@amsterdam.nl>
6
6
  Keywords: tools,Onderzoek & Statistiek
@@ -6,7 +6,7 @@ build-backend = "setuptools.build_meta"
6
6
 
7
7
  [project]
8
8
  name = "toolsos"
9
- version = "0.2.7"
9
+ version = "0.2.8"
10
10
  description = "OS tools"
11
11
  readme = "README.md"
12
12
  authors = [{ name = "OS", email = "d.schmitz@amsterdam.nl" }]
@@ -2,6 +2,7 @@ from __future__ import annotations
2
2
 
3
3
  from typing import Any, Union
4
4
 
5
+ import geopandas as gpd
5
6
  import requests
6
7
 
7
8
 
@@ -43,6 +44,14 @@ def get_geo_json(
43
44
  return json
44
45
 
45
46
 
47
+ def get_geo_dataframe(
48
+ level: str, year: Union[int, Any], with_water: bool = False, mra: bool = False
49
+ ):
50
+ return gpd.read_file(
51
+ get_geo_json(level=level, year=year, with_water=with_water, mra=mra)
52
+ )
53
+
54
+
46
55
  def extract_name_code_table(geo_json: dict[str, str]) -> dict[str, str]:
47
56
  """_summary_
48
57
 
@@ -278,7 +278,14 @@ def get_cols_id_with_pattern(df: pd.DataFrame, pattern: str) -> list[int]:
278
278
  Returns:
279
279
  list[int]: list with column indices matching pattern
280
280
  """
281
- return [idx for idx, col in enumerate(df.columns) if re.findall(pattern, col)]
281
+
282
+ if isinstance(df.columns, pd.MultiIndex):
283
+ # Use the lowest level in the multi-index column
284
+ return [
285
+ idx for idx, col in enumerate(df.columns) if re.findall(pattern, col[-1])
286
+ ]
287
+ else:
288
+ return [idx for idx, col in enumerate(df.columns) if re.findall(pattern, col)]
282
289
 
283
290
 
284
291
  def get_string_cols_ids(df: pd.DataFrame) -> list[int]:
@@ -702,6 +709,7 @@ def format_worksheet(
702
709
  "The number of widths defined in column_widths should be equal to the number of columsn in the dataframe"
703
710
  )
704
711
  col_widths = column_widths
712
+
705
713
  elif (autofit_columns == "column_names") or (autofit_columns is None):
706
714
  col_widths = get_max_col_widths(df)
707
715
  elif autofit_columns == "all_data":
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: toolsos
3
- Version: 0.2.7
3
+ Version: 0.2.8
4
4
  Summary: OS tools
5
5
  Author-email: OS <d.schmitz@amsterdam.nl>
6
6
  Keywords: tools,Onderzoek & Statistiek
File without changes
File without changes
File without changes
File without changes
File without changes