由于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就不适用了。