Skip to content

Commit

Permalink
improve dataframes
Browse files Browse the repository at this point in the history
  • Loading branch information
BSalita committed Jan 5, 2024
1 parent e06db6b commit 1fbac57
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion acbllib/acbllib.py
Original file line number Diff line number Diff line change
Expand Up @@ -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}')
print(f'Session count mismatch: {dirPath}: variance:{sessions_count-sessions_total}')
6 changes: 3 additions & 3 deletions default.favorites.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
]
},
Expand All @@ -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"
}
]
}
Expand Down

0 comments on commit 1fbac57

Please sign in to comment.