Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有一个数据框,其中包含列中的 n-gram 字符串。我想找到只包含一个目标词的行。我怎样才能做到这一点?我试过这段代码: df[df["column_name].str.match("targeted_word")]。但这会给出该目标词之后或之前的所有值。我需要得到只有目标词的行。
df[df["column_name].str.match("targeted_word")]
提前致谢。