Skip to content

Make boxplot also use numpy#31

Merged
liamjdavis merged 2 commits intomainfrom
fix-boxplots-numpy
May 25, 2025
Merged

Make boxplot also use numpy#31
liamjdavis merged 2 commits intomainfrom
fix-boxplots-numpy

Conversation

@BestLocation
Copy link
Collaborator

@BestLocation BestLocation commented May 25, 2025

This pull request introduces changes to improve error handling in the BoxPlot class and updates the example notebook to reflect these improvements. The changes ensure better validation of input data and enhance the reproducibility of the example.

Improvements to error handling in BoxPlot:

  • MatPlus/BoxPlot.py: Updated the data validation logic in the __init__ method to remove redundant checks. Specifically, the condition if not data or len(data) == 0 was replaced with if len(data) == 0 so numpy arrays work as well.

Updates to the example notebook:

  • examples/box_plot.ipynb:
    • Changed the example data from a simple list (data = [1, 2, 3, ..., 10]) to a more versatile NumPy-generated array (data2 = np.linspace(0, 10, 50)) to demonstrate a broader range of input data.
    • Updated the execution count and regenerated the box plot output to reflect the new data.

Description by Korbit AI

What change is being made?

Update the BoxPlot module to utilize NumPy for improved data validation efficiency and increment the package version to 0.2.1.

Why are these changes being made?

The existing BoxPlot implementation did not efficiently handle data validation, particularly with empty datasets. Incorporating NumPy allows for more robust and streamlined validation processes, enhancing performance and preventing errors. Incrementing the version to 0.2.1 reflects this minor adjustment.

Is this description stale? Ask me to generate a new description by commenting /korbit-generate-pr-description

Copy link

@korbit-ai korbit-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've completed my review and didn't find any issues... but I did find this penguin.

 __
( o>
///\
\V_/_
Files scanned
File Path Reviewed
MatPlus/BoxPlot.py

Explore our documentation to understand the languages and file types we support and the files we ignore.

Check out our docs on how you can make Korbit work best for you and your team.

Loving Korbit!? Share us on LinkedIn Reddit and X

@liamjdavis liamjdavis self-requested a review May 25, 2025 06:53
Copy link
Collaborator

@liamjdavis liamjdavis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@liamjdavis liamjdavis merged commit 393388a into main May 25, 2025
12 checks passed
@liamjdavis liamjdavis deleted the fix-boxplots-numpy branch May 25, 2025 06:54
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