0

I want to express in Pandas the equivalent of the following SQL

    select * from df where col_a is not null
verisimilidude
  • 475
  • 6
  • 9
  • 2
    `df[df['col_a'].notnull()]`? – Zero Jul 30 '17 at 08:46
  • Yes @JohnGalt, that did it. But looking at the question that you indicated was a duplicate had an answer that did not work, at least as I understood the answer. – verisimilidude Jul 30 '17 at 09:33
  • @verisimilidude The equivalent of `df[df['col_a'].notnull()]` is `df.dropna(subset=['col_a'])` But EdChum also offered an alternative there which is same as John Galt's suggestion: `nms[nms.name.notnull()]` – ayhan Jul 30 '17 at 12:17
  • Thank you @ayhan, `dropna` is what I need. I wish I could give you a +1 and a checkmark for your concise discussion of equivalents. I am trying to show R <-> pandas equivalency and na.omit in R is best paired with dropna. – verisimilidude Jul 31 '17 at 16:41

0 Answers0