Python Forum
pd.query method question
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
pd.query method question
#1
Hi,

I have a dataframe for which I want to create a filter.
I know you can do it via Boolean indexing, but now I found as well the pd.query method.

DF :
  col1  col2
0     Jan     3
1     Feb     4
2     Mar     5
df.query('col1 == "Feb"')
would normally work, but I wonder how you can filter on 2 columns as
df.query('col1 == "Feb" and col2 == "Mar"')
doesnt seem to work.

Thanks!
Reply


Messages In This Thread
pd.query method question - by PolskaYBZ - Jan-24-2019, 07:48 PM
RE: pd.query method question - by stullis - Jan-24-2019, 07:59 PM
RE: pd.query method question - by PolskaYBZ - Jan-24-2019, 08:10 PM
RE: pd.query method question - by stullis - Jan-24-2019, 09:14 PM
RE: pd.query method question - by PolskaYBZ - Jan-25-2019, 10:33 AM
RE: pd.query method question - by stullis - Jan-25-2019, 08:23 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  PyCharm IDE: Method Not Showing Up Question: Bug or Feature? Oliver 2 3,757 Dec-04-2017, 11:54 AM
Last Post: Oliver
  Apply Method Question smw10c 4 5,592 Apr-08-2017, 12:47 PM
Last Post: smw10c
  value_counts method question smw10c 4 4,917 Mar-22-2017, 10:59 PM
Last Post: zivoni

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020