Repository navigation
Conversation
The default BTable note was built from sentence chunks and then passed
through n[0] + n[1:].lower(), which lower-cased user labels
("US State" -> "us state") and the statistic names. Separately, the
robust-SE phrase already ended in "." before another "." was appended
("robust standard errors.."), a statistic list ending in "Std. Dev."
got a second period in both BTable and DTable, and the fixed effects +
clustered SE sentence had no final period.
Drop the lower-casing and end every sentence through one helper,
_end_sentence, which adds a period only when the text does not already
end with one.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What problem do you want to solve?
The default
BTablenote changes the case of user labels and ends sentences with doubled periods, or with none.main...clustered on us state....clustered on US State....robust standard errors.....robust standard errors.Displayed statistics are mean, std. dev.. p-values based on robust standard errors..Displayed statistics are Mean, Std. Dev. p-values based on robust standard errors....fixed effects and standard errors clustered on us state(no final period)...clustered on US State....N, Mean, Std. Dev.....N, Mean, Std. Dev.(The FE example uses three groups. With two groups and
fixed_effects,maincurrently raises anIndexError, which is handled separately.)Fix
n[0] + n[1:].lower()is removed. It lower-cased the whole note after its first character, including user labels and statistic names. Labels now appear exactly as in the table, e.g. "Mean" and "Std. Dev."._end_sentenceindtable.py, adds a period only when the text does not already end with one. The BTable statistics sentence, the BTable p-value sentences and the DTable note now all end through it."robust standard errors."loses its built-in period. It was the cause of the..in the hetero case.The edits are limited to the notes code (
btable.pyaround the default-notes block, and one expression indtable.py). They do not touch the p-value loop or thefixed_effectsdocstring.Tests
tests/api/test_dtable_btable.py:test_default_notes_keep_label_case_and_single_period, parametrized over the four BTable cases above, compares the full note string.test_bycol_hide_stats_notes(DTable) now compares the full note, so the doubled period is caught."clustered on hgroup"becomes"clustered on Hgroup"(the label passed is"Hgroup"), andendswith("mean.")becomesendswith("Mean.").On
main, the 4 new cases and the 3 tightened or updated assertions fail. All 42 tests in the file pass with the fix.pre-commit run --files <changed>andty checkare clean.Open question
Keeping "Mean" and "Std. Dev." capitalised mid-sentence follows the labels shown in the table. If you prefer lower-case built-in statistic names in the note, that can be done for the built-in names only, without touching user labels.
🤖 Generated with Claude Code