Skip to content

Reading Series with columns=[] doesn't return the index #2728

@G-D-Petrov

Description

@G-D-Petrov

Currently, reading Series with columns=[] returns an empty Series, instead of Series with the index like for DataFrame.
The is because Pandas doesn't support Series with index but empty data.
The use case is illustrated with this test:

def test_series_read_column_empty(lmdb_library_static_dynamic, sym):
    lib = lmdb_library_static_dynamic
    series = pd.Series(np.arange(366), name="test", index=pd.date_range("2020-01-01", "2020-12-31"))
    lib.write(sym, series)
    res = lib.read(sym, columns=[]).data
    assert res.empty
    assert res.index.equals(series.index)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions