Skip to content

gh-149949 :Validate invalid inputs in kde,kde_random functions in statistics.py#149950

Closed
ghost wants to merge 2 commits into
mainfrom
unknown repository
Closed

gh-149949 :Validate invalid inputs in kde,kde_random functions in statistics.py#149950
ghost wants to merge 2 commits into
mainfrom
unknown repository

Conversation

@ghost
Copy link
Copy Markdown

@ghost ghost commented May 17, 2026

The following PR fixes validation by checking all data points for the given data argument in kde() and kde_random() functions in the statistics module.

Modified the code from this:

if not isinstance(data[0], (int, float)):
        raise TypeError('Data sequence must contain ints or floats')

to:

if not all(isinstance(x, (int, float)) for x in data):
        raise TypeError('Data sequence must contain ints or floats')

@ghost ghost changed the title Validate invalid inputs kde gh-149949 :Validate invalid inputs in kde,kde_random functions in statistics.py May 17, 2026
Copy link
Copy Markdown
Member

@picnixz picnixz left a comment

Choose a reason for hiding this comment

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

The data sequence can be very large. It is unnecessary IMO. This is a GIGO in this case. For instance, other functions do not really check for that. Can you refrain from creating PRs when the problem has not yet been acknowledged as well please?

@bedevere-app
Copy link
Copy Markdown

bedevere-app Bot commented May 17, 2026

A Python core developer has requested some changes be made to your pull request before we can consider merging it. If you could please address their requests along with any other requests in other reviews from core developers that would be appreciated.

Once you have made the requested changes, please leave a comment on this pull request containing the phrase I have made the requested changes; please review again. I will then notify any core developers who have left a review that you're ready for them to take another look at this pull request.

@ghost ghost closed this May 17, 2026
@ghost ghost reopened this May 17, 2026
@ghost ghost closed this May 17, 2026
This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant