I was able to do by np select.
instal_final_csa2 =instal_final_csa
conditions = [((instal_final_csa2['MÊS'] >= 4 )&(instal_final_csa2['MÊS'] <= 12))&(instal_final_csa2['ANO'] == 2016),
((instal_final_csa2['MÊS'] >= 1 )&(instal_final_csa2['MÊS'] <= 3))&(instal_final_csa2['ANO'] == 2017),
((instal_final_csa2['MÊS'] >= 4 )&(instal_final_csa2['MÊS'] <= 12))&(instal_final_csa2['ANO'] == 2017),
((instal_final_csa2['MÊS'] >= 1 )&(instal_final_csa2['MÊS'] <= 3))&(instal_final_csa2['ANO'] == 2018),
((instal_final_csa2['MÊS'] >= 4 )&(instal_final_csa2['MÊS'] <= 12))&(instal_final_csa2['ANO'] == 2018),
((instal_final_csa2['MÊS'] >= 1 )&(instal_final_csa2['MÊS'] <= 3))&(instal_final_csa2['ANO'] == 2019),
((instal_final_csa2['MÊS'] >= 4 )&(instal_final_csa2['MÊS'] <= 12))&(instal_final_csa2['ANO'] == 2019),
((instal_final_csa2['MÊS'] >= 1 )&(instal_final_csa2['MÊS'] <= 3))&(instal_final_csa2['ANO'] == 2020),
((instal_final_csa2['MÊS'] >= 4 )&(instal_final_csa2['MÊS'] <= 12))&(instal_final_csa2['ANO'] == 2020),
((instal_final_csa2['MÊS'] >= 1 )&(instal_final_csa2['MÊS'] <= 3))&(instal_final_csa2['ANO'] == 2021),
((instal_final_csa2['MÊS'] >= 4 )&(instal_final_csa2['MÊS'] <= 12))&(instal_final_csa2['ANO'] == 2021),]
choices = ['FY16/17','FY16/17','FY17/18','FY17/18','FY18/19','FY18/19','FY19/20','FY19/20','FY20/21','FY20/21','FY21/22']
instal_final_csa['Fiscal Year'] = np.select(conditions,choices,default = 'nada')
Try:
instal_final_csa['Fiscal Year'] = instal_final_csa.apply(fiscal_year(instal_final_csa['MÊS'],instal_final_csa['ANO']), axis=1)
. Note that I added theaxis=1
– Paulo Marques
I tried, but returned the same error.
– Pedro Vitor