import pandas as pd
#e.g.,C:/Users/Username/../filename.csv
df = pd.read_csv("localhost_to_your_file_path")
#text1 & text2 are the texts you want to check if either of them are contained
contain_certain_text = df["column_you_want_to_explore"].str.contains(pat="text1|text2")
df["data__contain_certain_text"] = contain_certain_text
Check if some texts are contained in column. Returns True if contained, and false otherwise.
Be the first to comment
You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.