Skip to content

grouped.filter with axis=1 gave filtered rows #11041

Closed
@tdihp

Description

@tdihp

using pandas 0.16.2
minimum example here:

import numpy as np
import pandas as pd

index = pd.MultiIndex.from_product([range(10), [0, 1]])
data = pd.DataFrame(np.arange(100).reshape(-1, 20), columns=index)
data.groupby(level=0, axis=1).filter(lambda x: x.iloc[0, 0] > 10)

expected: get all filtered (grouped) columns as a DataFrame
result: IndexError

when change np.arange(100) to np.arange(1000) (more rows than columns)
results data frame with missing rows.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions