0

I have table 500rows x 7columns Im using pandas

  1. I filter last column with .str.contains

    filtered_table = table[
    (table['template'].str.contains("1A06", regex=True, case=False)) |
    (table['template'].str.contains("1A9U", regex=True, case=False)) |
    (table['template'].str.contains("1APM", regex=True, case=False)) |
    (table['template'].str.contains("1AQ1", regex=True, case=False)) |
    (table['template'].str.contains("1ATP", regex=True, case=False)) |
    (table['template'].str.contains("1B38", regex=True, case=False)) |
    (table['template'].str.contains("1B39", regex=True, case=False)) |
    ...~2000x
    (table['template'].str.contains("1BKX", regex=True, case=False)) |
    (table['template'].str.contains("1BL6", regex=True, case=False)) |
    (table['template'].str.contains("1BL7", regex=True, case=False)) |
    (table['template'].str.contains("1BLX", regex=True, case=False)) ]
    

Everything works fine, but pandas autors(?) changed something and script does not work

RecursionError: maximum recursion depth exceeded during compilation

Change in sys.setrecursionlimit() did not help

  1. Its crazy now because I have a list of 3000 x 4 leters filters eg. 'xyz1'

Do you know any alternative options?

MarcGrad
  • 3
  • 3
  • @MarcGrand show last column data and expected output – Zaraki Kenpachi Feb 16 '20 at 16:22
  • Can't you use the answer here to search within a list? https://stackoverflow.com/questions/26577516/how-to-test-if-a-string-contains-one-of-the-substrings-in-a-list-in-pandas – TYZ Feb 16 '20 at 16:25

0 Answers0