Feat: statistics table
This commit is contained in:
parent
ab5de2711e
commit
1a7c97d869
@ -55,6 +55,15 @@ layout = html.Div(
|
||||
],
|
||||
id="final_score_table_container",
|
||||
),
|
||||
html.Div(
|
||||
children=[
|
||||
dash_table.DataTable(
|
||||
id="score_statistics_table",
|
||||
columns=[],
|
||||
)
|
||||
],
|
||||
id="score_statistics_table_container",
|
||||
),
|
||||
],
|
||||
id="analysis",
|
||||
),
|
||||
|
@ -2,7 +2,6 @@
|
||||
# encoding: utf-8
|
||||
|
||||
from dash.dependencies import Input, Output, State
|
||||
import dash
|
||||
from dash.exceptions import PreventUpdate
|
||||
import dash_table
|
||||
import json
|
||||
@ -52,7 +51,6 @@ def update_exams_choices(tribe):
|
||||
],
|
||||
)
|
||||
def update_scores_store(exam):
|
||||
ctx = dash.callback_context
|
||||
if not exam:
|
||||
return [[], [], [], {}]
|
||||
exam = pd.DataFrame.from_dict([json.loads(exam)])
|
||||
@ -88,7 +86,26 @@ def update_scores_store(exam):
|
||||
Input("scores_table", "data"),
|
||||
],
|
||||
)
|
||||
def update_scores_store(scores):
|
||||
def update_finale_score_table(scores):
|
||||
scores_df = pd.DataFrame.from_records(scores)
|
||||
# print(scores_df)
|
||||
return score_to_final_mark(scores_df)
|
||||
|
||||
|
||||
@app.callback(
|
||||
[
|
||||
Output("score_statistics_table", "columns"),
|
||||
Output("score_statistics_table", "data"),
|
||||
],
|
||||
[
|
||||
Input("final_score_table", "data"),
|
||||
],
|
||||
)
|
||||
def update_statictics_table(finale_score):
|
||||
df = pd.DataFrame.from_records(finale_score)
|
||||
statistics = df["mark"].describe().to_frame().T
|
||||
print(statistics)
|
||||
return [
|
||||
[{"id": c, "name": c} for c in statistics.columns],
|
||||
statistics.to_dict("records"),
|
||||
]
|
||||
|
Loading…
Reference in New Issue
Block a user