Skip to content

Series.combine and ExtensionArrays #22850

Closed
@TomAugspurger

Description

@TomAugspurger
Contributor

Working on a PeriodArray. For the first thing I tried, Series.combine doesn't work.

In

pandas/pandas/core/series.py

Lines 2324 to 2330 in 7343fd3

elif is_extension_array_dtype(self.values):
# The function can return something of any type, so check
# if the type is compatible with the calling EA
try:
new_values = self._values._from_sequence(new_values)
except TypeError:
pass
we catch a TypeError. Why is that just a TypeError, when in principal the EA constructor could throw any kind of exception? In my case a ValueError is ValueError since the freq can't be inferred.

I think that should be except Exception instead. Thoughts @Dr-Irv?

Activity

added this to the 0.24.0 milestone on Sep 27, 2018
jorisvandenbossche

jorisvandenbossche commented on Sep 27, 2018

@jorisvandenbossche
Member

Yes, I think that can be broadened to general exception.

Dr-Irv

Dr-Irv commented on Sep 27, 2018

@Dr-Irv
Contributor

IMHO, I would just add the errors that you know that could occur. So if ValueError can be raised by ._from_sequence(), then I think you should do except TypeError, ValueError. If some other error is raised, then it might catch another issue in someone's code.

TomAugspurger

TomAugspurger commented on Sep 27, 2018

@TomAugspurger
ContributorAuthor
added a commit that references this issue on Oct 2, 2018
added a commit that references this issue on Oct 9, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Dtype ConversionsUnexpected or buggy dtype conversionsExtensionArrayExtending pandas with custom dtypes or arrays.

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @jorisvandenbossche@TomAugspurger@Dr-Irv

        Issue actions

          Series.combine and ExtensionArrays · Issue #22850 · pandas-dev/pandas