Skip to content

DOC: is_float_dtype meant to be an internal function?? #48101

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

Closed
MRyderOC opened this issue Aug 15, 2022 · 6 comments · Fixed by #48156
Closed

DOC: is_float_dtype meant to be an internal function?? #48101

MRyderOC opened this issue Aug 15, 2022 · 6 comments · Fixed by #48156
Labels
Docs Dtype Conversions Unexpected or buggy dtype conversions

Comments

@MRyderOC
Copy link

Seems like there is no function for public API to check the dtype of an array-like object. Either the documentation needs to be changed or a public function should be provided and treat this one as an internal one by adding underscore at the beginning of it.

P.S. To keep the consistency between "int" and "float" dtype functions, it's better to add another function like is_float64_dtype and keep the current one and triage the documentation.

This function is internal and should not be exposed in the public API.

@mroeschke
Copy link
Member

pandas documents that accessing anything in core is essentially private: https://pandas.pydata.org/pandas-docs/stable/reference/index.html

Depending on your use case, this function may work for you https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.api.types.is_float.html

@mroeschke mroeschke added the Needs Info Clarification about behavior needed to assess issue label Aug 15, 2022
@MRyderOC
Copy link
Author

API reference states that:

pandas.api.types subpackage holds some public functions related to data types in pandas.

pandas.api.types.is_float is for checking a single object no the array-like objects. is_float_dtype is a function like pandas.api.types.is_integer_dtype.

@mroeschke
Copy link
Member

Ah yes thanks for the correction. Yes then https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.api.types.is_float_dtype.html is meant to be a public function.

I guess since https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.api.types.is_int64_dtype.html is also public then is_float64_type should also be public too

@mroeschke mroeschke added Docs Dtype Conversions Unexpected or buggy dtype conversions and removed Needs Info Clarification about behavior needed to assess issue labels Aug 15, 2022
@MRyderOC
Copy link
Author

Just for clarification:
pandas.api.types.is_integer_dtype exists (for any int type)
pandas.api.types.is_int64_dtype exists (for int64 type)
pandas.api.types.is_float_dtype exists (for any float type) have docs problem
pandas.api.types.is_float64_dtype does NOT exist.

We can change this issue to an enhancement one and I'm pleased to take care of both the documentation and the new function.

@MRyderOC
Copy link
Author

@mroeschke any updates on this?
Should we just clean the docs or should we implement the is_float64_dtype?

@phofl
Copy link
Member

phofl commented Aug 19, 2022

@MRyderOC Could you open a dedicated issue, if you think having a function if_float64_dtype is necessary/a good idea? Also adding a use case where this is helpful would be great. float32 is not very well supported within pandas, this might be a reason why the function does not exist.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Docs Dtype Conversions Unexpected or buggy dtype conversions
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants