What is the Pandas equivalent of this SQL code?
Select id, fname, lname from table where id = 123
I know this is the equivalent of the SQL 'where' clause in Pandas:
df[df['id']==123]
And this selects specific columns:
df[['id','fname','lname']]
But I canβt understand how to combine them. All the examples that I saw on the Internet select all columns with conditions. I want to select a limited number of columns with one or more conditions.
Dread source
share