-1

what is the pandas equivalent of

SELECT Column2 FROM DF WHERE column3 ="value"

when we are using dataframe please

THANK YOU

anayisse
  • 43
  • 6

1 Answers1

0

You can use .loc and a conditional statement on a Dataframe to select out relevant information, similar to a where clause. You can pull out your desired column(s) using a second argument to loc, e.g.

df.loc[df[column3]==“value”, [column2]]
Jemma Borland
  • 390
  • 1
  • 7
  • No, you mustn't use two levels of selection, especially when it can be done with 1. – cs95 Oct 31 '18 at 22:36
  • I’ve amended my answer to only use one level of selection. – Jemma Borland Oct 31 '18 at 22:37
  • hello!! It works perfectly now but to verifiy 2 colums value .. I TRYIED This but it doesn't work ....`df.loc[df["column3"]== "value" & df["column1"] == "value2", ['column2']]` .. Have you any ideas please – anayisse Nov 01 '18 at 13:58