Pandas converting String object to lower case and checking for string

private["ISH"] = private.HolidayName.str.contains("(?i)holiday|recess")

The (?i) in the regex pattern tells the re module to ignore case.


The reason why you were getting an error is because the Series object does not have the contains method; instead the Series.str attribute has the contains method. So you could avoid the error with:

private["ISH"] = private.HolidayName.str.lower().str.contains("holiday|recess")

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)