Skip to content

ERR: consistency in rolling on empty frames #15819

Closed
@jreback

Description

@jreback

xref https://github.com/pandas-dev/pandas/pull/15795/files#r108178445

I think we should just return an empty frame for [4]

In [4]: DataFrame().rolling('1s').sum()
ValueError: window must be an integer

In [5]: DataFrame().rolling(1).sum()
Out[5]: 
Empty DataFrame
Columns: []
Index: []

though this works.

In [7]: DataFrame(index=pd.DatetimeIndex([])).rolling(1).sum()
Out[7]: 
Empty DataFrame
Columns: []
Index: []

In [8]: DataFrame(index=pd.DatetimeIndex([])).rolling('1s').sum()
Out[8]: 
Empty DataFrame
Columns: []
Index: []

Metadata

Metadata

Assignees

No one assigned

    Labels

    DatetimeDatetime data dtypeError ReportingIncorrect or improved errors from pandasReshapingConcat, Merge/Join, Stack/Unstack, Explode

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions