Skip to content

API: many custom errors / warnings are not exposed in pandas.errors #27656

Closed
@jorisvandenbossche

Description

@jorisvandenbossche

From #27553 and #27522, I quickly looked at how consistent we are with defining errors and warnings in pandas.errors.

So we have a pandas.errors module which is meant to publicly expose our custom exceptions and warnings.

Some are defined there such as PerformanceWarning, UnsortedIndexError, ParserError, ... (https://github.com/pandas-dev/pandas/blob/bb6135880e5e453d7701764b9f2e4ad3356a68d7/pandas/errors/__init__.py).
But many are not:

  • tslibs.parsing.DateParseError
  • tslibs.period.IncompatibleFrequency
  • pandas/_config/config.py: OptionError
  • pandas/core/base.py: DataError, GroupByError, SpeciicationError
  • pandas/core/common.py: SettingWithCopyError/Warning
  • pandas/core/computation/common/py: NameResolutionError
  • pandas/core/computation/engine.py: NumExprClobberingError
  • pandas/core/computation/ops.py: UndefinedVariableError
  • pandas/core/indexes/base.py: InvalidIndexError
  • pandas/coreindexing.py: IndexingError
  • pandas/io/clipboard/exceptions.py: PyperclipException
  • pandas/io/formats/css.py: CSSWarning
  • pandas/io/msgpack: several exceptions
  • pandas/io/pytables.py: lots of exceptions
  • pandas/io/sql.py: SQLALchemyRequired, DatabaseError
  • pandas/io/stata.py: several warnings

Do we want to move them all to the public pandas.errors module?
Are there reasons that some can / should not be moved? Eg should the cython ones be defined in the cython file for performance?
Are there certain custom exceptions/warnings that we rather convert in a built-in one instead of publicly exposing them?
Do we want to move all the io related ones? (those modules are somewhat public)

Metadata

Metadata

Assignees

Labels

API DesignEnhancementError ReportingIncorrect or improved errors from pandasWarningsWarnings that appear or should be added to pandas

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions