Search code examples
dataframeblaze

Select some columns based on WHERE in a dataframe


So, I am working with Blaze and wanted to perform this query on a dataframe:

SELECT col1,col2 FROM table WHERE col1 > 0

For SELECT *, this works: d[d.col1 > 0]. But I want col1 and col2 only rather than all columns. How should I go about it?

Thanks in advance!

Edit: Here I create d as: d = Data('postgresql://uri')


Solution

  • This also works: d[d.col1 > 0][['col1','col2']]