Skip to content

BUG: fillna() for tz-aware timestamps causes an exception #15855

Closed
@chrisaycock

Description

@chrisaycock

Suppose I have a DataFrame of timestamps:

df = pd.DataFrame({'A': [pd.Timestamp('2012-11-11 00:00:00'),
                         pd.Timestamp('2012-11-11 00:00:00')]})

I can attempt to fill any nulls:

In [23]: df.fillna(method='pad')
Out[23]:
           A
0 2012-11-11
1 2012-11-11

Now suppose my timestsamps are tz-aware:

df = pd.DataFrame({'A': [pd.Timestamp('2012-11-11 00:00:00+00:00'),
                         pd.Timestamp('2012-11-11 00:00:00+00:00')]})

This causes an error:

In [25]: df.fillna(method='pad')
...
ValueError: total size of new array must be unchanged

This does not appear to be fixed by #14960.

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugMissing-datanp.nan, pd.NaT, pd.NA, dropna, isnull, interpolateTimezonesTimezone data dtype

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions