由于data.loc[value]和 data[data.key==value] 這兩者之間有一定的差異,第一種方式返回的可能是series,第二種方式返回的是dataframe,所以在做復雜條件篩選的的時候,可能會爆str相關的錯誤。
例如:
account_instal[(account_instal['key1'] == value1) \
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?&(account_instal['key2'] == value2) \
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?&(account_instal['key3']<value3) \
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?&((account_instal['key4']<value4) | (account_instal['key5'].isna()))?
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ]?
這個是針對dataframe寫的,但是作為series就不適用了。