I have a pandas
dataframe:
id name
63 T台
64 4S店
66 江南style
68 1号店
69 小S
70 大S
72 一
73 一一
74 一一二
77 一一列举
79 一一对应
80 一一记
81 一一道来
82 一丁
84 一丁点
I'm trying to create a new dataframe only with the rows that don't have characters from a certain list in the column name
:
letters = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', '%', '+']
I found several questions somewhat similar (like this), but they are filtering based on specific values (e.g. df[(df['count'] == '2') & (df['price'] == '100')]
), and not from a list of values.
The output should be a new dataframe without rows 63-70 in this example.
I tried to do something similar to get a list of True
/False
that I can use on the dataframe to filter:
('a' not in current_dataframe['name'])
But this only outputs one value for some reason:
>>> True