-
Notifications
You must be signed in to change notification settings - Fork 3.8k
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
[python-package] Better column dtype logging when column has "bad dtype" #5065
[python-package] Better column dtype logging when column has "bad dtype" #5065
Conversation
Current failing tests look (seemingly) unrelated to this PR AFAICT. It's failing on |
Thank you for your contribution! What do you think about changing the bad_dtypes = _get_bad_pandas_dtypes(df.dtypes)
if bad_dtypes:
raise ValueError(f"Bad dtypes: {', '.join(bad_dtypes)}") |
The reason I didn't initially do that was that My opinion is that the latter is cleaner and that we should integrate that with your approach. My thinking for making the func get called on a series would be to do |
I'm +1 on using |
I'm for moving duplicated post-processing code into the |
just to confirm before I do any more work on this tomorrow - you mean moving everything, including error raising, inside the function? I'd be fine with that as it reduces a large amount of similar code, and we don't lose much in the error message (we can just treat them all like the DataFrame based error messages and it should be obvious from the stack trace that it was in fact a series in the singular series case) |
Sounds like a good plan! Also, maybe with the aim to not confuse users with DataFrame/Series words, we can refer to dtypes as "pandas dtypes" or something similar? |
Co-authored-by: José Morales <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thank you so much for the help!
Just one nit below:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very nice change, thanks for the help with this! I also approve, and think this should be merged once @StrikerRUS 's one additional comment has been addressed.
Co-authored-by: Nikita Titov <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for your contribution!
thanks for the reviews! |
This pull request has been automatically locked since there has not been any recent activity since it was closed. To start a new related discussion, open a new issue at https://github.com/microsoft/LightGBM/issues including a reference to this. |
Closes #5064