Skip to content

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

Closed
@z1yuan

Description

@z1yuan

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$).*')

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions