Skip to content

ENH: DtypeWarning message enhancement #58250

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

Merged

Conversation

abeltavares
Copy link
Contributor

@abeltavares abeltavares commented Apr 13, 2024

@abeltavares abeltavares force-pushed the ENH/DtypeWarning-message-enhancement branch 5 times, most recently from 89369f5 to 8c6b027 Compare April 13, 2024 18:40
@@ -37,6 +37,7 @@ Other enhancements
- Users can globally disable any ``PerformanceWarning`` by setting the option ``mode.performance_warnings`` to ``False`` (:issue:`56920`)
- :meth:`Styler.format_index_names` can now be used to format the index and column names (:issue:`48936` and :issue:`47489`)
- :meth:`DataFrame.cummin`, :meth:`DataFrame.cummax`, :meth:`DataFrame.cumprod` and :meth:`DataFrame.cumsum` methods now have a ``numeric_only`` parameter (:issue:`53072`)
- ``DtypeWarning`` improved to include column names when mixed data types are detected (:issue:`58174`)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- ``DtypeWarning`` improved to include column names when mixed data types are detected (:issue:`58174`)
- :class:`.errors.DtypeWarning` improved to include column names when mixed data types are detected (:issue:`58174`)

@@ -8,6 +8,8 @@

from pandas.io.parsers.c_parser_wrapper import _concatenate_chunks

COLUMN_NAMES = ["column_0", "column_1"]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you just inline this where it's used?


if warning_columns:
warning_names = ",".join(warning_columns)
warning_names = ", ".join(
[f"{index}: {name}" for index, name in enumerate(warning_columns, start=0)]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
[f"{index}: {name}" for index, name in enumerate(warning_columns, start=0)]
[f"{index}: {name}" for index, name in enumerate(warning_columns)]

@mroeschke mroeschke added IO CSV read_csv, to_csv Warnings Warnings that appear or should be added to pandas labels Apr 15, 2024
@abeltavares abeltavares force-pushed the ENH/DtypeWarning-message-enhancement branch from 8c6b027 to d050d4e Compare April 18, 2024 20:43
@abeltavares abeltavares force-pushed the ENH/DtypeWarning-message-enhancement branch from d050d4e to 405b00f Compare April 18, 2024 20:52
@abeltavares abeltavares requested a review from mroeschke April 18, 2024 21:45
@mroeschke mroeschke added this to the 3.0 milestone Apr 18, 2024
@mroeschke mroeschke merged commit e13d808 into pandas-dev:main Apr 18, 2024
46 checks passed
@mroeschke
Copy link
Member

Thanks @abeltavares

pmhatre1 pushed a commit to pmhatre1/pandas-pmhatre1 that referenced this pull request May 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
IO CSV read_csv, to_csv Warnings Warnings that appear or should be added to pandas
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ENH: DtypeWarning message enhancement
2 participants