Skip to content

ENH: add validate parameter to Categorical.from_codes #53122

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

Conversation

topper-123
Copy link
Contributor

validate : bool, default True
If True, validate that the codes are valid for the dtype.
If False, don't validate that the codes are valid.

Copy link
Member

Choose a reason for hiding this comment

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

If you don’t validate you risk a segfault so user beware

@mroeschke mroeschke added the Categorical Categorical Data Type label May 8, 2023
@mroeschke mroeschke added this to the 2.1 milestone May 9, 2023
@mroeschke mroeschke merged commit a37451f into pandas-dev:main May 9, 2023
@mroeschke
Copy link
Member

Thanks @topper-123

@topper-123 topper-123 deleted the enh_categorical_from__codes_validate_param branch May 9, 2023 18:47
Rylie-W pushed a commit to Rylie-W/pandas that referenced this pull request May 19, 2023
* ENH: add validate parameter to Categorical.from_codes

* add GH number

* simplify a bit

* add segfault warning
Daquisu pushed a commit to Daquisu/pandas that referenced this pull request Jul 8, 2023
* ENH: add validate parameter to Categorical.from_codes

* add GH number

* simplify a bit

* add segfault warning
@topper-123 topper-123 added Enhancement Performance Memory or execution speed performance labels Aug 15, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Categorical Categorical Data Type Enhancement Performance Memory or execution speed performance
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ENH/PERF: add validate parameter to 'Categorical.from_codes' get avoid validation when not needed
3 participants