flatbread 0.1.4__tar.gz → 0.1.5__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 (30) hide show
  1. {flatbread-0.1.4 → flatbread-0.1.5}/PKG-INFO +1 -1
  2. {flatbread-0.1.4 → flatbread-0.1.5}/flatbread/agg/aggregation.py +7 -9
  3. {flatbread-0.1.4 → flatbread-0.1.5}/pyproject.toml +1 -1
  4. {flatbread-0.1.4 → flatbread-0.1.5}/.gitignore +0 -0
  5. {flatbread-0.1.4 → flatbread-0.1.5}/environment.yml +0 -0
  6. {flatbread-0.1.4 → flatbread-0.1.5}/flatbread/__init__.py +0 -0
  7. {flatbread-0.1.4 → flatbread-0.1.5}/flatbread/accessors/dataframe.py +0 -0
  8. {flatbread-0.1.4 → flatbread-0.1.5}/flatbread/accessors/index.py +0 -0
  9. {flatbread-0.1.4 → flatbread-0.1.5}/flatbread/accessors/series.py +0 -0
  10. {flatbread-0.1.4 → flatbread-0.1.5}/flatbread/agg/totals.py +0 -0
  11. {flatbread-0.1.4 → flatbread-0.1.5}/flatbread/chaining.py +0 -0
  12. {flatbread-0.1.4 → flatbread-0.1.5}/flatbread/config/config.defaults.json +0 -0
  13. {flatbread-0.1.4 → flatbread-0.1.5}/flatbread/config.py +0 -0
  14. {flatbread-0.1.4 → flatbread-0.1.5}/flatbread/percentages.py +0 -0
  15. {flatbread-0.1.4 → flatbread-0.1.5}/flatbread/render/config.py +0 -0
  16. {flatbread-0.1.4 → flatbread-0.1.5}/flatbread/render/constants.py +0 -0
  17. {flatbread-0.1.4 → flatbread-0.1.5}/flatbread/render/display.py +0 -0
  18. {flatbread-0.1.4 → flatbread-0.1.5}/flatbread/render/tablespec.py +0 -0
  19. {flatbread-0.1.4 → flatbread-0.1.5}/flatbread/render/template.jinja.html +0 -0
  20. {flatbread-0.1.4 → flatbread-0.1.5}/flatbread/render/template.py +0 -0
  21. {flatbread-0.1.4 → flatbread-0.1.5}/flatbread/testing/dataframe.py +0 -0
  22. {flatbread-0.1.4 → flatbread-0.1.5}/flatbread/tooling.py +0 -0
  23. {flatbread-0.1.4 → flatbread-0.1.5}/license.md +0 -0
  24. {flatbread-0.1.4 → flatbread-0.1.5}/readme.md +0 -0
  25. {flatbread-0.1.4 → flatbread-0.1.5}/tests/__init__.py +0 -0
  26. {flatbread-0.1.4 → flatbread-0.1.5}/tests/aggregate/__init__.py +0 -0
  27. {flatbread-0.1.4 → flatbread-0.1.5}/tests/aggregate/test_percentages.py +0 -0
  28. {flatbread-0.1.4 → flatbread-0.1.5}/tests/aggregate/test_totals.py +0 -0
  29. {flatbread-0.1.4 → flatbread-0.1.5}/tests/test_axes.py +0 -0
  30. {flatbread-0.1.4 → flatbread-0.1.5}/tests/test_levels.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: flatbread
3
- Version: 0.1.4
3
+ Version: 0.1.5
4
4
  Summary: Pandas extension for aggregation and tabular display
5
5
  Project-URL: Homepage, https://github.com/lcvriend/flatbread
6
6
  Author-email: "L.C. Vriend" <vanboefer@gmail.com>
@@ -203,18 +203,16 @@ def _subagg_implementation(
203
203
  # create key
204
204
  levels = (levels,) if pd.api.types.is_scalar(levels) else levels
205
205
 
206
- # format label with level name if requested
207
- current_label = label
206
+ # Get the actual level value to include in the label
207
+ level_value = levels[-1] if isinstance(levels, tuple) else levels
208
+
209
+ # Create the subtotal label with the level value if requested
210
+ subtotal_label = label
208
211
  if include_level_name:
209
- # get level name
210
- if isinstance(level, (int, str)):
211
- level_name = names[level] if isinstance(level, int) else level
212
- current_label = f"{label} {level_name}"
213
- elif isinstance(levels[-1], str):
214
- current_label = f"{label} {levels[-1]}"
212
+ subtotal_label = f"{label} {level_value}"
215
213
 
216
214
  padding = [_fill] * (len(names) - len(levels) - 1)
217
- key = list(levels) + [current_label] + padding
215
+ key = list(levels) + [subtotal_label] + padding
218
216
 
219
217
  # ignore totals and subtotal rows when aggregating
220
218
  rows = chaining.get_data_mask(group.index, ignore_keys)
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
4
4
 
5
5
  [project]
6
6
  name = "flatbread"
7
- version = "0.1.4"
7
+ version = "0.1.5"
8
8
  description = "Pandas extension for aggregation and tabular display"
9
9
  readme = "readme.md"
10
10
  requires-python = ">=3.10"
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes