check if a value is present in a column pandas code example
Example 1: check if value is in series pandas
In [21]: s.unique()
Out[21]: array(['a', 'b', 'c'], dtype=object)
In [22]: 'a' in s.unique()
Out[22]: True
Example 2: check if a string is contained in a column R
fruit <- c("apple", "banana", "pear", "pinapple") # [1] TRUE
identical(str_detect(fruit, "a"), grepl("a",fruit)) # [1] TRUE
identical(str_detect(fruit, "^a"), grepl("^a",fruit)) # [1] TRUE
identical(str_detect(fruit, "a$"), grepl("a$",fruit)) # [1] TRUE
identical(str_detect(fruit, "b"), grepl("b",fruit)) # [1] TRUE
identical(str_detect(fruit, "[aeiou]"), grepl("[aeiou]",fruit)) # [1] TRUE