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")


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM