pandas取出包含某个值的所有行
df = df[df[“from_account”].str.contains(“fcwhx”)]

pandas取出不包含某个值的所有行
df = df[~df[“from_account”].str.contains(“fcwhx”,“na=False”)]

df = df[df[“from_account”].str.contains(“fcwhx”)==False]

如果有空值,报错:TypeError: bad operand type for unary ~: ‘float’
则用这个方法
df.other_group = df.other_group.fillna(’####@’)
df2 = df[~df[‘other_group’].str.contains(’####@’)]

相关文章:

  • 2022-12-23
  • 2021-07-15
  • 2022-12-23
  • 2021-12-20
  • 2022-12-23
  • 2022-12-23
  • 2021-12-09
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-01-20
  • 2021-07-24
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案