我想将所有只有表情符号的行(如df['Comments'][2]
)更改为N/A
df['Comments'][:6]
0 nice
1 Insane3
2 😻😻❤️
3 @bertelsen1986
4 20 or 30 mm rise on the Renthal Fatbar?
5 Luckily I have one to 🔥💪🏻
以下代码没有返回我期望的输出:
df['Comments'].replace(';', ':', '!', '*', np.NaN)
预期产出:
df['Comments'][:6]
0 nice
1 Insane3
2 nan
3 @bertelsen1986
4 20 or 30 mm rise on the Renthal Fatbar?
5 Luckily I have one to 🔥💪🏻
通过迭代每行中的unicode字符(使用emoji和unicodedata包),可以检测仅包含emojis的行:
函数(remove_emoji)引用https://stackoverflow.com/a/61839832/6075699
试试看
安装第一个
emoji
lib-pip install emoji
相关问题 更多 >
编程相关推荐