Sign up to take part
Registered users can ask their own questions, contribute to discussions, and be part of the Community!
Registered users can ask their own questions, contribute to discussions, and be part of the Community!
This instruction runs fine in the notebook but when I go back to the recipe and execute it it throws this error:
datatype = df.to_dict('records')[0]['datatype']
Is there a sort of custom pandas in the recipe that is not the same as the one in the notebook version?
Thanks in advanced for your help.
Dario
Operating system used: linux AWS
Hi @darioromero ,
The error may suggest the df you have in your recipe is empty. You could try to handle this case :
if not df.empty:
data_list = df.to_dict('records')
datatype = data_list[0]['datatype']
# Perform operations with datatype
else:
# Handle the case when the DataFrame is empty
Thanks Alex. dataframe was empty. Appreciate it.
Hi @darioromero ,
The error may suggest the df you have in your recipe is empty. You could try to handle this case :
if not df.empty:
data_list = df.to_dict('records')
datatype = data_list[0]['datatype']
# Perform operations with datatype
else:
# Handle the case when the DataFrame is empty
Thanks Alex. dataframe was empty. Appreciate it.