They should be one regular expression, and should be in one string:

"nt|nv"  # rather than "nt" | " nv"
f_recs[f_recs['Behavior'].str.contains("nt|nv", na=False)]

Python doesn't let you use the or (|) operator on strings:

In [1]: "nt" | "nv"
TypeError: unsupported operand type(s) for |: 'str' and 'str'
Answer from Andy Hayden on Stack Overflow
๐ŸŒ
GeeksforGeeks
geeksforgeeks.org โ€บ pandas โ€บ python-pandas-series-str-contains
Pandas Series.str.contains() - Python - GeeksforGeeks
January 13, 2026 - The Series.str.contains() method is used to check whether each string value in a Pandas Series contains a given substring or pattern.
๐ŸŒ
Programiz
programiz.com โ€บ python-programming โ€บ pandas โ€บ methods โ€บ str-contains
Pandas str.contains() (With Examples)
The str.contains() method returns a Boolean Series showing whether each element in the Series contains the pattern or regex. import pandas as pd # create a Series data = pd.Series(['apple', 'banana', 'cherry', 'date'])
๐ŸŒ
w3resource
w3resource.com โ€บ pandas โ€บ series โ€บ series-str-contains.php
Pandas Series: str.contains() function - w3resource
September 15, 2022 - Pandas Series - str.contains() function: The str.contains() function is used to test if pattern or regex is contained within a string of a Series or Index.
๐ŸŒ
Note.nkmk.me
note.nkmk.me โ€บ home โ€บ python โ€บ pandas
pandas: Extract rows that contain specific strings from a DataFrame | note.nkmk.me
July 30, 2023 - By using str.contains(), you can generate a Series where elements that contain a given substring are True. pandas.Series.str.contains โ€” pandas 2.0.3 documentation
๐ŸŒ
Vultr Docs
docs.vultr.com โ€บ python โ€บ third-party โ€บ pandas โ€บ Series โ€บ str โ€บ contains
Python Pandas Series str contains() - Check Substring Presence | Vultr Docs
December 5, 2024 - The str.contains() method in Pandas is an essential tool for checking the presence of a substring within each string element of a Series. This approach is particularly useful in data analysis and processing where conditions based on string patterns ...
๐ŸŒ
Medium
medium.com โ€บ @amit25173 โ€บ understanding-pandas-str-contains-ba3e6a7d30b3
Understanding pandas str.contains() | by Amit Yadav | Medium
March 6, 2025 - It helps you check if a string exists within another string in a pandas Series. Simply put, str.contains() checks if a particular substring (like "apple" or "data") exists within the text data of a pandas Series.
Find elsewhere
๐ŸŒ
Statology
statology.org โ€บ home โ€บ pandas: how to check if column contains string
Pandas: How to Check if Column Contains String
March 31, 2025 - This tutorial explains how to check if a column contains a string in a pandas DataFrame, including several examples.
๐ŸŒ
Pandas
pandas.pydata.org โ€บ pandas-docs โ€บ version โ€บ 0.23.4 โ€บ generated โ€บ pandas.Series.str.contains.html
pandas.Series.str.contains โ€” pandas 0.23.4 documentation
Series.str.contains(pat, case=True, flags=0, na=nan, regex=True)[source]ยถ ยท Test if pattern or regex is contained within a string of a Series or Index. Return boolean Series or Index based on whether a given pattern or regex is contained within a string of a Series or Index.
๐ŸŒ
Medium
medium.com โ€บ @whyamit101 โ€บ understanding-pandas-series-str-contains-7c9a3b3bd545
Understanding pandas.Series.str.contains() | by why amit | Medium
February 26, 2025 - str.contains() is like asking Pandas, โ€œHey, does this text contain what Iโ€™m looking for?โ€ It helps you filter data in a column based on whether a string pattern exists.
๐ŸŒ
Spark By {Examples}
sparkbyexamples.com โ€บ home โ€บ pandas โ€บ pandas series.str.contains() with examples
Pandas Series.str.contains() With Examples - Spark By {Examples}
December 9, 2024 - Pandas Series.str.contains() method is used to check whether each string in a Series contains a specified substring or pattern. It returns a
๐ŸŒ
Plus2Net
plus2net.com โ€บ python โ€บ pandas-str-contains.php
str.contains to search string or pattern matching in columns series using Pandas
df=df[df['name'].str.contains(... pd.DataFrame(data=my_dict) print(df) This will return all the rows We will use contains() to get only rows having ar in name column....
๐ŸŒ
TutorialsPoint
tutorialspoint.com โ€บ python_pandas โ€บ python_pandas_series_str_contains_method.htm
Pandas Series.str.contains() Method
The Series.str.contains() method in Pandas is used to test if a pattern or regex is contained within a string of a Series or Index. This method returns a boolean Series or Index based on whether the given pattern is present in each string.
๐ŸŒ
IncludeHelp
includehelp.com โ€บ python โ€บ pandas-dataframe-str-contains-and-operation.aspx
Python - Pandas dataframe str.contains() AND operation
For this purpose, we will first create a DataFrame with a column containing some strings and then we will use contains() method with this column of DataFrame. We will then use AND operator use & syntax and apply another contains() method on the same column. ... # Importing pandas package import ...
๐ŸŒ
InterviewQs
interviewqs.com โ€บ ddi-code-snippets โ€บ col-contains-pandas
SearchInput pandas column with string contains and does not contain - InterviewQs
#here we can count the number of distinct users viewing on a given day new_df2 = df[~df['name'].str.contains('Morris', na=False)] new_df2.head()