A dash data table of mine keeps throwing the following error:
Invalid argument
columns[1].name
passed into DataTable with ID “table3”
This error pops up with debug=True and prevents the table from populating within the div. When debug=False, the table populates and has the correct data and even changes using callbacks, so I think this is just a bug thta has to do with how I create the data frame used for that table. Below is the process and results for the creation of that table’s data frame, where df_table_3 is the dataframe I use for the table.
TLDR of code below: I create two dfs (one to determine grade level of each student, the other to determine how many classes that student is failing and both share the same index) then I combine both dfs into one df and use crosstab to create a table that tells me how many students in each grade are failing 1,2,3,4, or 5 classes.
studentgradelevel = dff[(dff['Quarter Grade']<70)][['Student ID','Grade']].groupby('Student ID').mean()
Result:
Grade
Student ID
203350103 9
203588009 11
205186042 10
206862567 12
207667585 12
studentfails = dff[(dff['Quarter Grade']<70)].groupby('Student ID')['Course'].nunique()
Result:
Student ID
203350103 5
203588009 1
205186042 2
206862567 5
207667585 4
df_fail_nums_by_student = pd.concat([studentgradelevel,studentfails],axis=1)
Result:
Student ID
203350103 9 5
203588009 11 1
205186042 10 2
206862567 12 5
207667585 12 4
df_table_3 = pd.crosstab(df_fail_nums_by_student['Grade'],df_fail_nums_by_student['Course']).reset_index()
Result:
Course Grade 1 2 3 4 5
0 9 24 14 15 29 23
1 10 12 16 12 15 35
2 11 20 9 7 10 8
3 12 9 9 8 12 12
1 post - 1 participant