I am trying to convert SQL code into equivalent python code.
My SQL code is given below:
select count(*),sum(days) into :_cnt_D_DmRP_1D, :_pd_D_DmRP_1D
from _fw_bfr_wgt
where pk=1 and type=1 and input(zipcode,8.) not in (700001:735999)
and input(zipcode,8.) not in (&cal_list.);
I was trying to convert this code into python.
My python code is given below:
cnt_D_DmRP_1D,_pd_D_DmRP_1D=df.loc[(df['pk']==1) & (df['type']==1) & (df['zipcode'] not in(list(range(700001,(735999+1))))),'days'].agg(['size','sum']) & (df['zipcode'] not in(cal_list)),df.loc['days'].agg(['size','sum'])
Here df is the dataframe which is _fw_bfr_wgt in SQL code, that I have already created.
But I am getting an error:
ValueError: The truth value of a Series is ambiguous. Use a.empty, a.bool(), a.item(), a.any() or a.all().
Unable to resolve this issue as I am a beginner in python. Need help and suggestion to fix this error.