Skip to content

Bug: Don't intercept TypeError in DataFrame.aggΒ #49399

Closed
@rhshadrach

Description

@rhshadrach

pandas/pandas/core/apply.py

Lines 735 to 745 in 3370c81

try:
result = super().agg()
except TypeError as err:
exc = TypeError(
"DataFrame constructor called with "
f"incompatible data and dtype: {err}"
)
raise exc from err
finally:
self.obj = obj
self.axis = axis

We intercept any TypeError and reword the message to be about the DataFrame constructor. This likely made sense before, but with the code being refactored and #43741, TypeErrors can occur for many different reasons. We should just remove the except block above.

Metadata

Metadata

Labels

ApplyApply, Aggregate, Transform, MapDataFrameDataFrame data structureError ReportingIncorrect or improved errors from pandasgood first issue

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions