Skip to content

ENH: Improve Filter function with Filter_Columns and Filter_Rows #55289

Open
@speed650

Description

@speed650

Feature Type

  • Adding new functionality to pandas

  • Changing existing functionality in pandas

  • Removing existing functionality in pandas

Problem Description

Using the [ ] syntax can get messy/complicated for applying filters to a dataframe. The current Filter() function is also confusing to use. I Propose adding dedicated functions to quickly filter out columns and rows to make Pandas easier to use.

Feature Description

Propose adding 2 new functions

Filter_Columns(), Filter_Rows()

def Filter_Columns( columns: List, inverse:Bool, inplace:Bool )
def Filter_Rows( Rows: List, inverse:Bool, inplace:Bool )

Usage:

Filter_Columns( ['Names', 'Ages' ], inverse=False, inplace=True)

Shows columns for name and age.. Inverse is used to hide show other columns that are not name and age.

def Filter_Rows( [ ('name'==bob), ( 'age' > 20) ] , inverse:Bool, inplace:Bool )

Shows dataframe where the value in names column =bob, and age column >20

Chained

Filter_Columns( ['Names', 'Ages' ], inverse=False, inplace=True).Filter_Rows( [ ('name'==bob), ( 'age' > 20) ] , inverse:Bool, inplace:Bool )

Alternative Solutions

Use [ ] syntex... More confusing

Additional Context

No response

Metadata

Metadata

Assignees

Labels

EnhancementFilterse.g. head, tail, nthNeeds DiscussionRequires discussion from core team before further action

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions