Skip to content

.filter with regex #20

@mattharrison

Description

@mattharrison

Hi Matt, I'm working through your Effective Pandas book and might have found a typo at the start of the chapter Reshaping Dataframes with Dummies.

You write:

>>> (jb
...  .filter(like=r'job.role.*t')
...  .where(jb.isna(), 1)
... )

but with pandas 1.4.3 that doesn't work. I can leave as .filter(like="job.role") and get the 13 columns as intended, or I can use .filter(regex=r"job.role.*t") and get the 8 columns that have a "t" in the job title.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions