ValueError: The truth value of a Series is ambiguous. Use a.empty, a.bool(), a.item(), a.any() or a.all().
# mfbaseinfo_org[mfbaseinfo_org['prod_code']=='008345'] exc_chfsec['prod_begin_date'] = pd.to_datetime(exc_chfsec['prod_begin_date']) exc_chfsec['init_date'] = pd.to_datetime(exc_chfsec['init_date']) for i in list(exc_chfsec['prod_code']): if ((exc_chfsec.loc[exc_chfsec['prod_code']==i,'prod_begin_date']) ) > ((exc_chfsec.loc[exc_chfsec['prod_code']==i,'init_date'])): print(i) else: print("paa")
改为:
# mfbaseinfo_org[mfbaseinfo_org['prod_code']=='008345'] exc_chfsec['prod_begin_date'] = pd.to_datetime(exc_chfsec['prod_begin_date']) exc_chfsec['init_date'] = pd.to_datetime(exc_chfsec['init_date']) for i in list(exc_chfsec['prod_code']): if ((exc_chfsec.loc[exc_chfsec['prod_code']==i,'prod_begin_date']).values ) > ((exc_chfsec.loc[exc_chfsec['prod_code']==i,'init_date']).values): print(i) else: print("paa")
既然无论如何时间都会过去,为什么不选择做些有意义的事情呢