0
我有一个数据帧df,列作为column1 通过使用str.match我如何检查列值是否在任何一个值('Value1','值2' )str.match()Python匹配任何一个值
这是可以做到这样
(df['column1'].str.lower().str.match(Value1')) | (df['column1'].str.lower().str.match('Value2'))
或像这样通过使用lambda表达式:
df[column1].apply(lambda x : True if x in ['Value1','Value2'] else False)
寻找类似的东西
(df['column1'].str.lower().str.match('Value1' | 'Value1'))
是的,这是我想要的。 –