Skip to content

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

Closed
manoj-km24 wants to merge 2 commits into
python:mainfrom
manoj-km24:validate-invalid-inputs-kde
Closed

gh-149949 :Validate invalid inputs in kde,kde_random functions in statistics.py#149950
manoj-km24 wants to merge 2 commits into
python:mainfrom
manoj-km24:validate-invalid-inputs-kde

Conversation

@manoj-km24
Copy link
Copy Markdown
Contributor

@manoj-km24 manoj-km24 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')

@manoj-km24 manoj-km24 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.

@manoj-km24 manoj-km24 closed this May 17, 2026
@manoj-km24 manoj-km24 reopened this May 17, 2026
@manoj-km24 manoj-km24 closed this May 17, 2026
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.

2 participants