From 1fbac57b2bd4f34d5070110fc5da76d7426d8081 Mon Sep 17 00:00:00 2001 From: Bob Salita Date: Fri, 5 Jan 2024 08:30:54 -0500 Subject: [PATCH] improve dataframes --- acbllib/acbllib.py | 2 +- default.favorites.json | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/acbllib/acbllib.py b/acbllib/acbllib.py index f4ad7e5..1a3ca64 100644 --- a/acbllib/acbllib.py +++ b/acbllib/acbllib.py @@ -509,4 +509,4 @@ def download_tournament_players_history(player_ids, acbl_api_key, dirPath): with open(filePath_json,'w',encoding='UTF8') as f: f.write(json.dumps(session_json, indent=4)) if sessions_count != sessions_total: - print(f'Session count mismatch: {dirPath}: variance:{sessions_count-sessions_total}') \ No newline at end of file + print(f'Session count mismatch: {dirPath}: variance:{sessions_count-sessions_total}') diff --git a/default.favorites.json b/default.favorites.json index dd7e940..e4f6b00 100644 --- a/default.favorites.json +++ b/default.favorites.json @@ -536,7 +536,7 @@ "prompts": [ { "prompt": "", - "sql": "SELECT Number_Declarer, Name_Declarer, SUM(CASE WHEN Declarer_Direction = Declarer_Direction_Pred THEN 1 ELSE 0 END) AS Correct_Preds, COUNT() AS Boards_Declared, Correct_Preds/Boards_Declared AS Correct_Direction_Pct, SUM(CASE WHEN (Declarer_Direction IN ('N','S') AND Declarer_Direction_Pred IN ('N', 'S')) OR (Declarer_Direction IN ('E','W') AND Declarer_Direction_Pred IN ('E', 'W')) THEN 1 ELSE 0 END) AS Correct_Pair_Preds, Correct_Pair_Preds/Boards_Declared AS Correct_Pair_Pct FROM results GROUP BY Number_Declarer, Name_Declarer ORDER BY Correct_Direction_Pct DESC, Boards_Declared DESC" + "sql": "SELECT CONCAT(Number_Declarer, ' - ', Name_Declarer, ' - ', Declarer_Direction) AS Player_Direction, SUM(CASE WHEN Declarer_Direction = Declarer_Direction_Pred THEN 1 ELSE 0 END) AS Correct_Preds, COUNT() AS Boards_Declared, STRING_AGG(CASE WHEN Declarer_Direction = Declarer_Direction_Pred THEN Board END, ', ') AS Correctly_Pred_Boards, STRING_AGG(CASE WHEN Declarer_Direction <> Declarer_Direction_Pred THEN Board END, ', ') AS Declared_Not_Predicted, Correct_Preds/Boards_Declared AS Correct_Direction_Pct, SUM(CASE WHEN (Declarer_Direction IN ('N','S') AND Declarer_Direction_Pred IN ('N', 'S')) OR (Declarer_Direction IN ('E','W') AND Declarer_Direction_Pred IN ('E', 'W')) THEN 1 ELSE 0 END) AS Correct_Pair_Preds, Correct_Pair_Preds/Boards_Declared AS Correct_Pair_Pct FROM results GROUP BY Number_Declarer, Name_Declarer, Declarer_Direction ORDER BY Correct_Direction_Pct DESC, Boards_Declared DESC" } ] }, @@ -547,11 +547,11 @@ "prompts": [ { "prompt": "", - "sql": "SELECT Number_Declarer AS Declarer_NS, Name_Declarer AS Name, AVG(Pct_NS) AS Pct_NS_Actual, AVG(Pct_NS_Pred) AS Pct_NS_Pred, COUNT() AS Boards_Declared FROM results WHERE Pair_Declarer_Direction='NS' GROUP BY Number_Declarer, Name_Declarer ORDER BY Pct_NS_Actual DESC, Boards_Declared DESC" + "sql": "SELECT Number_Declarer AS Declarer_NS, Name_Declarer AS Name, AVG(Pct_NS) AS Pct_NS_Actual, AVG(Pct_NS_Pred) AS Pct_NS_Pred, COUNT() AS Boards_Declared, AVG(CAST(Tricks > DDTricks AS INT)) AS Pct_GT_DD, AVG(CAST(Tricks = DDTricks AS INT)) AS Pct_EQ_DD FROM results WHERE Pair_Declarer_Direction='NS' GROUP BY Number_Declarer, Name_Declarer ORDER BY Pct_NS_Actual DESC, Boards_Declared DESC" }, { "prompt": "", - "sql": "SELECT Number_Declarer AS Declarer_EW, Name_Declarer AS Name, AVG(Pct_EW) AS Pct_EW_Actual, AVG(Pct_EW_Pred) AS Pct_EW_Pred, COUNT() AS Boards_Declared FROM results WHERE Pair_Declarer_Direction='EW' GROUP BY Number_Declarer, Name_Declarer ORDER BY Pct_EW_Actual DESC, Boards_Declared DESC" + "sql": "SELECT Number_Declarer AS Declarer_EW, Name_Declarer AS Name, AVG(Pct_EW) AS Pct_EW_Actual, AVG(Pct_EW_Pred) AS Pct_EW_Pred, COUNT() AS Boards_Declared, AVG(CAST(Tricks > DDTricks AS INT)) AS Pct_GT_DD, AVG(CAST(Tricks = DDTricks AS INT)) AS Pct_EQ_DD FROM results WHERE Pair_Declarer_Direction='EW' GROUP BY Number_Declarer, Name_Declarer ORDER BY Pct_EW_Actual DESC, Boards_Declared DESC" } ] }