Reputation: 877
This is my DataFrame
date time ticker price
495 20200324 100000 LKOH 4484.0
496 20200324 100000 LKOH 4481.5
500 20200324 100000 LKOH 4482.0
623 20200324 100001 LKOH 4482.0
679 20200324 100001 LKOH 4482.0
... ... ... ... ...
986321 20200324 183954 LKOH 4498.5
986336 20200324 183955 LKOH 4497.0
986385 20200324 183956 LKOH 4498.5
986481 20200324 183958 LKOH 4497.0
986482 20200324 183958 LKOH 4497.0
I apply to it filter:
df = df[df['time'] <184000]
But I DONT want to filter data for rows with ticker 'USDRUB'
So I need something like:
df = df[if ticker != 'USDRUB' then use filter df['time'] <184000]
How to write it correctly?
Upvotes: 0
Views: 37
Reputation: 5745
try the or |
operation:
df = df[(df['time'] <184000) | (df["ticker"] == 'USBROB')]
Upvotes: 2