Hello everyone,
I have a question. I am currently working on the Page Visits Funnel Project. I completed it but then I experimented a bit and tried to define a function, that, given the df and column_name, automatically calculates the percent of users, who have not come to this step:
This is my code:
def pct_null(df,column_name):
return len(df[df.column_name.isnull()])/float(len(df))
pct_null(all_data,purchase_time)
You can see all_data here:
All_Data_Codeacademy
However, it always throws a mistake:
pct_null(all_data,purchase_time)
NameError: name ‘purchase_time’ is not defined
What did I do wrong? Thank you in advance