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

Fix validation of numeric types #69

Merged
merged 4 commits into from
Sep 25, 2024
Merged

Commits on Sep 24, 2024

  1. Add column type validation tests for metrics/plot

    Each of these functions requires some columns to be numeric.
    
    Signed-off-by: John Pennycook <[email protected]>
    Pennycook committed Sep 24, 2024
    Configuration menu
    Copy the full SHA
    cca34e0 View commit details
    Browse the repository at this point in the history
  2. Add regression test for efficiency with string FOM

    Signed-off-by: John Pennycook <[email protected]>
    Pennycook committed Sep 24, 2024
    Configuration menu
    Copy the full SHA
    e66cc7b View commit details
    Browse the repository at this point in the history
  3. Replace _require_numeric with _cast_to_numeric

    Whereas _require_numeric simply checked that the values in a DataFrame
    could be interpreted as numbers, _cast_to_numeric actually performs the
    cast and returns the result.
    
    Signed-off-by: John Pennycook <[email protected]>
    Pennycook committed Sep 24, 2024
    Configuration menu
    Copy the full SHA
    02bd229 View commit details
    Browse the repository at this point in the history
  4. Avoid false positives in _cast_to_numeric

    Previously, _cast_to_numeric would raise a TypeError if a column was
    missing. We now check that a column exists before trying to cast it.
    
    This does result in some redundant checking, as some functions call both
    _require_columns and _cast_to_numeric. We may want to consider
    refactoring to combine all of this functionality into a single DataFrame
    validation step.
    
    Signed-off-by: John Pennycook <[email protected]>
    Pennycook committed Sep 24, 2024
    Configuration menu
    Copy the full SHA
    8ed2454 View commit details
    Browse the repository at this point in the history