You may want to give the isin
method a shot.
axx = clean_df.loc[(clean_df['service_part_number'] == pn_list[3]) & (clean_df['months_in_service'].isin([1,2,3])), 'service_technician_comment']
If you use the dictionary implementation of isin
, you should be able to get the same results while placing whatever equal
predicates you may have:
axx = clean_df[clean_df.isin({"service_part_number": [pn_list[3]], "months_in_service", [1,2,3]})]["service_technician_comment"]
Just keep in mind, you cannot use loc
when using isin
like this, as it will raise: ValueError: Cannot index with multidimensional key
.