Home > Software design >  How to print only integers that are true in a column in jupyter
How to print only integers that are true in a column in jupyter

Time:09-27

Uploading a CSV , and importing pandas, and matplotlib, I produce 10k rows, and some of the rows in "attachments" have attachments and some do not. I would like to know how to make print only the rows with 1 or more attachments associated with them and disregard the ones that have zero.

df[["to","from","attachments"]] # created a list of names to filter through

CodePudding user response:

You may try this one :

df[df["attachments"] >= 1]

To answer your commentary :

Is there a way to have this result, in conjunction with the attachments that have only 1 or more with "to", "from"

df[(df["attachments"] >= 1) & (df["to"] >= 1) & (df["from"] >= 1)]
  • Related