I have a df named bas
. For example it looks like this:
nat rac numberOnly
0 DD AR 548484554
1 AD AR 168484245
2 FF COL 484984554
3 WW DE 484845225
...
It has 50k+ rows. I tried to got only records with rac == AR or COL
.
I wrote that code:
AR = bas.where(bas.rac == "AR").dropna()
COL = bas.where(bas.rac == "COL").dropna()
DF = pd.DataFrame()
DF = DF.append(AR)
DF = DF.append(COL)
And Len of df is 27429. But the code dosen't look good. Especially that I want to filter more rac
later. So I decided to recode it in this way:
DF = bas.where(bas.rac == ("AR" or "COL")).dropna()
And in this case DF has 27196 rows.
Why? What's the difference here? Which method is better? Maybe I should use something else, instead?