The answers in Count number of rows when row contains certain text got me part way...
Columns are labeled "1a.", "2a.", and "3a." Rows are each labeled with unique identifiers (random alpha-numeric code).
How do you count how many rows contain at least 1 of 10 letters across multiple columns?
This code works for one column: len(df[df['1a.'].str.contains('A|I|M|Q|C|K|G|O|E|S')])
I tried for multiple columns using len(df[df['1a.'|'2a.'|'3a.'].str.contains('A|I|M|Q|C|K|G|O|E|S')])
and get an error:
TypeError Traceback (most recent call last) in ----> 1 len(df[df['1a.'|'2a.'|'3a.'].str.contains('A|I|M|Q|C|K|G|O|E|S')])
TypeError: unsupported operand type(s) for |: 'str' and 'str'
The row should only be counted once, whether the three columns contain "A" and "I" and "M" (all three letters on the list) OR "A" and "B" and "L" (last two letters not on the list).