How to get the index of the element in the dataframe column that can't be corced to the type of this column? #506
Unanswered
mkondratyev85
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I'm trying to use pandera for validate dataframes that sometimes have wrong values in certain cells.
I would like to print out the exact positions of the cells that were casing the error. But it seems like I can't get this info from the errors that I catch with try-except block.
Here is the example code:
And here is the output:
As you can see, there is no information about the index of the problem element in column Y.
Is there a way to get this position?
And why are all other elements in Y column is also have the problem now (not_nullable) while they can be represented as float?
EDIT:
After researching this issue for a while, I figured out that the problem is on the stage of trying to coerce values in column Y to the
float
type. If I change the invalid dataframe to be with all number values but add additional check for the field so that some values in my invalid dateframe would not pass, then, I would get the index of the position of the wrong element in the dataframe:So my question could be narrowed down a bit like this:
How to get the index of the element in the dataframe column that can't be corced to the type of this column?
Beta Was this translation helpful? Give feedback.
All reactions