看起来很丑:
df_cut = df_new[
(
(df_new['l_ext']==31) |
(df_new['l_ext']==22) |
(df_new['l_ext']==30) |
(df_new['l_ext']==25) |
(df_new['l_ext']==64)
)
]
不起作用:
df_cut = df_new[(df_new['l_ext'] in [31, 22, 30, 25, 64])]
上述“问题”是否存在一种优雅且可行的解决方案?
使用isin
df_new[df_new['l_ext'].isin([31, 22, 30, 25, 64])]
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句