Find rows containing specific values in a Pandas Dataframe

Suppose we have Pandas dataframe, df, with a column called Name.

The data looks in the column look like this:

Statute of Westminster, The First (1275)
1275 c. 5
Statute of Marlborough 1267 [Waste]
1267 c. 23
The Statute of Marlborough 1267 [Distress]
1267 c. 1

If we wanted to exclude all rows that contain something like 1275 c.5 from the dataframe, we can use Pandas str.contains() method in combination with a regular expression, like so:

df = df[df['Statute_Name'].str.contains('\d{4}\s+([a-z]|[A-Z])') == False]

This is basically saying that df is now equal to all of the rows in df where a match on our regular expression returns False.

Setting == True would have the opposite effect; retaining rows that match the expressions and dropping those that do not.