pandas
pandas copied to clipboard
dataframe.astype() exception message to include column name
- [X] closes #47571(Replace xxxx with the Github issue number)
- [x] Tests added and passed if fixing a bug or adding a new feature
- [x] All code checks passed.
- [X] Added type annotations to new arguments/methods/functions.
- [ ] Added an entry in the latest
doc/source/whatsnew/vX.X.X.rstfile if fixing a bug or adding a new feature.
Description:
Added column related info as part of astype exceptions
| Code | Old Error | New Error |
|---|---|---|
| pd.DataFrame({'a':[1,2,"text"], 'b':[1,2,3]}).astype({'a': int}) | ValueError: invalid literal for int() with base 10: 'text' | ValueError: Error during type conversion for column a: invalid literal for int() with base 10: 'text' |
thanks for the review @phofl @mroeschke sure @phofl, will update the PR with changes
Hi @mroeschke , had missed following up on this PR. feel free to let me know if any changes are required here (or) if we should hold this PR for the time being.
Thanks in advance :)
Thanks @dannyi96