48

これは信じられないほど簡単なはずですが、うまくいきません。

2 つ以上の値でデータセットをフィルター処理したいと考えています。

#this works, when I filter for one value
df.loc[df['channel'] == 'sale'] 

#if I have to filter, two separate columns, I can do this
df.loc[(df['channel'] == 'sale')&(df['type']=='A')] 

#but what if I want to filter one column by more than one value?
df.loc[df['channel'] == ('sale','fullprice')] 

これは OR ステートメントである必要がありますか? in を使用して SQL のようなことができますか?

4

1 に答える 1