effective_pandas_book icon indicating copy to clipboard operation
effective_pandas_book copied to clipboard

.filter with regex

Open mattharrison opened this issue 3 years ago • 0 comments

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.

mattharrison avatar Jul 18 '22 17:07 mattharrison