我需要找到那些
__
李>数据集如下所示:
User_ID CODE
A12 AAada __fa
F453 21 ads
J43 Has AA
... ...
H21 MNasdf
L32 sad 21
M54 43__12 asd
... ...
我应该做的是:
__
的所有用户,即A12和M54李>我已经尝试过使用regex对用户进行过滤,如果是数字,则使用^[^0-9]*$
(但也可以使用df.CODE.str.contains('^\d+\'
),如果是__
,则使用/[$-/:-?{-~!"^_[]]/
您可以使用
|
(或)withstr.contains()
with|
分隔三种模式:可以对序列
series.str.contains()
使用字符串访问器。这是user guide以及解决方案的代码
输出
以后可以使用这些掩码中的每一个来过滤数据帧。在这种情况下,最好将它们作为单独的遮罩,因为它们似乎有重叠
相关问题 更多 >
编程相关推荐