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

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']).values ) > ((exc_chfsec.loc[exc_chfsec['prod_code']==i,'init_date']).values):
        print(i)
    else:
        print("paa")

相关文章:

  • 2021-06-08
  • 2021-12-08
  • 2022-12-23
  • 2021-06-04
  • 2022-12-23
  • 2021-12-30
  • 2022-12-23
  • 2022-03-03
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-08-06
  • 2022-12-23
  • 2021-04-05
  • 2021-10-27
  • 2021-08-16
相关资源
相似解决方案