Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[188552693]: Rework subtotal diffs for cat dates #402

Closed

Conversation

ernestoarbitrio
Copy link
Contributor

No description provided.

Copy link

codecov bot commented Nov 11, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 100.00%. Comparing base (adb1c24) to head (6a732f5).

Additional details and impacted files
@@            Coverage Diff            @@
##            master      #402   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           20        20           
  Lines         4756      4774   +18     
=========================================
+ Hits          4756      4774   +18     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@gergness
Copy link
Contributor

We'll talk tomorrow, but here's what I was thinking this morning. I haven't made sure it will work, but my suspicion is that it will be best to change the behavior in matrix.measures._ColumnProportions here:

@lazyproperty
def _intersections(self):
"""(n_row_subtotals, n_col_subtotals) ndarray of intersection values.
An intersection value arises where a row-subtotal crosses a column-subtotal.
"""
# --- do not propagate divide-by-zero warnings to stderr ---
with np.errstate(divide="ignore", invalid="ignore"):
return self._count_blocks[1][1] / self._weighted_base_blocks[1][1]
@lazyproperty
def _subtotal_columns(self):
"""2D np.float64 ndarray of column proportions values.
This is the second "block" and has the shape (n_rows, n_col_subtotals).
"""
# --- do not propagate divide-by-zero warnings to stderr ---
with np.errstate(divide="ignore", invalid="ignore"):
return self._count_blocks[0][1] / self._weighted_base_blocks[0][1]
@lazyproperty
def _subtotal_rows(self):
"""2D np.float64 ndarray of column proportions values.
This is the third "block" and has the shape (n_row_subtotals, n_cols).
"""
# --- do not propagate divide-by-zero warnings to stderr ---
with np.errstate(divide="ignore", invalid="ignore"):
return self._count_blocks[1][0] / self._weighted_base_blocks[1][0]

(and for _RowProportions and I guess _TableProportions?)

@ernestoarbitrio ernestoarbitrio deleted the rework-subtotal-diffs-for-cat-dates-188552693 branch November 18, 2024 21:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants