Skip to content

An extra single quotation marks (') in cheat sheet/ Subset Variables (Columns)/regex (Regular Expressions) Examples #25156

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
z1yuan opened this issue Feb 5, 2019 · 1 comment · Fixed by #25215
Labels
Milestone

Comments

@z1yuan
Copy link

z1yuan commented Feb 5, 2019

Problem description

https://github.com/pandas-dev/pandas/blob/master/doc/cheatsheet/Pandas_Cheat_Sheet.pdf

In Pandas_Cheat_Sheet/ Subset Variables (Columns)/ regex (Regular Expressions) Examples

''^(?!Species$).*' Matches strings except the string 'Species'

The second ' in regex is unnecessary.

Expected Output

execute sucessfully

Actual result:

# features = data_df.filter(regex=''^(?!SalePrice$).*')

File "", line 5
features = data_df.filter(regex=''^(?!SalePrice$).*')
^
SyntaxError: invalid syntax

should be:

# features = data_df.filter(regex='^(?!SalePrice$).*')
@gfyoung gfyoung added the Docs label Feb 7, 2019
@gfyoung
Copy link
Member

gfyoung commented Feb 7, 2019

Good catch!

cc @TomAugspurger @Dr-Irv

xref #20366

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants