i have a dataframe with column sent:
sent
"error was found"
"я ищу новый error"
"загрузка завершена"
"new file is uploaded"
as you see some rows are fully latin strings, some are mixed and some are fully non-latin. i'd like to drop rows with fully latin string rows. so desired output is:
sent
"я ищу новый error"
"загрузка завершена"
how could i do that?
P.S.
I consider letters like ĄŻĆ latin as well
CodePudding user response:
You can remove lines that has no Cyrillic letters.
import pandas as pd
sent = ["error was found",
"я ищу новый error",
"загрузка завершена",
"new file is uploaded"]
df = pd.DataFrame(sent, columns=['sent'])
df = df[df['sent'].str.contains('[а-яА-Я]')] # filter dataframe
print(df)
Output
sent
1 я ищу новый error
2 загрузка завершена