I need to grab values where the column startswith either value 'MA', 'KP'.
I am trying to chain my dataframe query as such:
df.loc[df['REFERRAL_GRP'].str.startswith("KP")==True | df['REFERRAL_GRP'].str.startswith("MA")==True]
This doesn't seem to work because the column contains pd.nan objects (NULL values).
By themselves, the queries work, how can I merge these two queries together?
Thank you
Here is my error message:
Traceback (most recent call last):
Debug Probe, prompt 40, line 1
File "c:\Python27\Lib\site-packages\pandas\core\generic.py", line 892, in __nonzero__
.format(self.__class__.__name__))
ValueError: The truth value of a Series is ambiguous. Use a.empty, a.bool(), a.item(), a.any() or a.all().