I need to count the number of occurrences of a regex pattern in an entire dataframe.
Is the following the most efficient method?
df = df.applymap(str)
count = 0
for col in df:
count = count + df[col].str.contains(regex_search, case=False).sum()
print('Count: ', count)