pandas 多条件筛选

res=output.loc[(output['date'] >= pd.to_datetime('2019-1-1')) & (output['date'] <= pd.to_datetime('2022-1-9'))]

 

condition=(df['constant_std']==0) & ((df['constant_mu']!=0) | (df['constant_mu']!=capacity))
constant_end_index=df[condition]['index'] ##find end index

注意条件式子要括号,逻辑符不能用and,不然会有错

posted @ 2022-01-11 11:01  笨笨和呆呆  阅读(285)  评论(0)    收藏  举报