-
Notifications
You must be signed in to change notification settings - Fork 36
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
IsDtypeValidation not accepting multiple dtypes for a DataFrame Column #61
Comments
Hmm this is a bug if it's exhibiting this behaviour. Can you post a reproducible example where a sub dtype isn't validating correctly? |
thanks for quick reply. I tried again with dtype=np.number and it worked. since internally np.number is accepted by np.issubdtype(). There is another issue now. I see yellow warning(in PyCharm IDE) in dtype=np.number in IsDtypeValidation(), as variable annotation for dtype is specialized only to np.dtype which should be generalized to some super type. |
Can you show me the warning message? |
Okay so it's a bug with the type annotation. I just need to find out what type annotation is used internally by numpy/pandas and use the same one, or else have a |
I am trying to input int or float, in parameter dtype of IsDtypeValidation but it doesn't accept multiple types. As a general type, i tried with numbers.Number which is a general class for all numbers but it throws error: "The column column_name has a dtype of int64 which is not a subclass of the required type <class 'numbers.Number'>".
Similar error comes when i have assigned it to np.dtype(float) and values in column are only integer.
Same for np.dtype('d'), np.dtype(np.inexact) n all.
I tried using np.inexact or numbers.Number because i thought np.issubdtype() would accept it as True. Is it so?
How can i take multiple dtypes in a column and validate it to True? like it can be float if value in column is float, it can be integer, if value is integer.
The text was updated successfully, but these errors were encountered: