https://github.com/pandas-dev/pandas/blob/3370c8179de16b3f0556891a1ff06131e186dfd1/pandas/core/apply.py#L735-L745

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.

Comment From: sarvaSanjay

So just to confirm all we want to do is delete lines 737-742 ? Or do we have to add more specific ways to intercept type errors?

Comment From: rhshadrach

So just to confirm all we want to do is delete lines 737-742 ?

That's correct; since this can raise for e.g. a user-defined function, I don't believe we can be any more helpful than just allowing the normal error to raise.

Comment From: sarvaSanjay

take

Comment From: alexanderwertman3

I would like to work on this for a school project

Comment From: yuvanist

@sarvaSanjay If you are not updating the test for this, I'll take it. Please let me know.

Comment From: yuvanist

take

Comment From: yuvanist

@rhshadrach https://github.com/pandas-dev/pandas/pull/49969 PR closes this. Please review.