Commit
·
233415d
1
Parent(s):
5e99630
Adjustments on the invalid markets graphs
Browse files- app.py +6 -6
- tabs/invalid_markets.py +4 -4
app.py
CHANGED
@@ -303,12 +303,12 @@ with demo:
|
|
303 |
with gr.Row():
|
304 |
gr.Markdown("# Daily distribution of invalid trades")
|
305 |
with gr.Row():
|
306 |
-
plot_daily_dist_invalid_trades(invalid_trades)
|
307 |
|
308 |
-
with gr.Row():
|
309 |
-
|
310 |
-
with gr.Row():
|
311 |
-
|
312 |
|
313 |
with gr.Row():
|
314 |
gr.Markdown("# Top markets with invalid trades")
|
@@ -318,7 +318,7 @@ with demo:
|
|
318 |
with gr.Row():
|
319 |
gr.Markdown("# Daily distribution of invalid markets")
|
320 |
with gr.Row():
|
321 |
-
plot_daily_nr_invalid_markets(invalid_trades)
|
322 |
|
323 |
with gr.TabItem("🏥 Tool Error Dashboard"):
|
324 |
with gr.Row():
|
|
|
303 |
with gr.Row():
|
304 |
gr.Markdown("# Daily distribution of invalid trades")
|
305 |
with gr.Row():
|
306 |
+
invalid_trades = plot_daily_dist_invalid_trades(invalid_trades)
|
307 |
|
308 |
+
# with gr.Row():
|
309 |
+
# gr.Markdown("# Ratio of invalid trades per market")
|
310 |
+
# with gr.Row():
|
311 |
+
# plot_ratio_invalid_trades_per_market(invalid_trades)
|
312 |
|
313 |
with gr.Row():
|
314 |
gr.Markdown("# Top markets with invalid trades")
|
|
|
318 |
with gr.Row():
|
319 |
gr.Markdown("# Daily distribution of invalid markets")
|
320 |
with gr.Row():
|
321 |
+
invalid_markets = plot_daily_nr_invalid_markets(invalid_trades)
|
322 |
|
323 |
with gr.TabItem("🏥 Tool Error Dashboard"):
|
324 |
with gr.Row():
|
tabs/invalid_markets.py
CHANGED
@@ -7,12 +7,12 @@ from seaborn import FacetGrid
|
|
7 |
|
8 |
def plot_daily_dist_invalid_trades(invalid_trades: pd.DataFrame):
|
9 |
"""Function to paint the distribution of daily invalid trades, no matter which market"""
|
10 |
-
|
11 |
plt.xticks(rotation=45, ha="right")
|
12 |
plt.xlabel("Creation date")
|
13 |
plt.ylabel("Daily number of invalid trades")
|
14 |
plt.title("Distribution of daily invalid trades over time")
|
15 |
-
return gr.Plot(value=
|
16 |
|
17 |
|
18 |
def plot_daily_nr_invalid_markets(invalid_trades: pd.DataFrame):
|
@@ -49,9 +49,9 @@ def plot_top_invalid_markets(invalid_trades: pd.DataFrame):
|
|
49 |
"""Function to paint the top markets with the highest number of invalid trades"""
|
50 |
top_invalid_markets = invalid_trades.title.value_counts().reset_index()
|
51 |
top_invalid_markets.rename(columns={"count": "nr_invalid_trades"}, inplace=True)
|
52 |
-
plt.figure(figsize=(
|
53 |
plot = sns.barplot(
|
54 |
-
top_invalid_markets,
|
55 |
x="nr_invalid_trades",
|
56 |
y="title",
|
57 |
hue="title",
|
|
|
7 |
|
8 |
def plot_daily_dist_invalid_trades(invalid_trades: pd.DataFrame):
|
9 |
"""Function to paint the distribution of daily invalid trades, no matter which market"""
|
10 |
+
plot2 = sns.histplot(data=invalid_trades, x="creation_date", kde=True)
|
11 |
plt.xticks(rotation=45, ha="right")
|
12 |
plt.xlabel("Creation date")
|
13 |
plt.ylabel("Daily number of invalid trades")
|
14 |
plt.title("Distribution of daily invalid trades over time")
|
15 |
+
return gr.Plot(value=plot2.get_figure())
|
16 |
|
17 |
|
18 |
def plot_daily_nr_invalid_markets(invalid_trades: pd.DataFrame):
|
|
|
49 |
"""Function to paint the top markets with the highest number of invalid trades"""
|
50 |
top_invalid_markets = invalid_trades.title.value_counts().reset_index()
|
51 |
top_invalid_markets.rename(columns={"count": "nr_invalid_trades"}, inplace=True)
|
52 |
+
plt.figure(figsize=(40, 15))
|
53 |
plot = sns.barplot(
|
54 |
+
top_invalid_markets.head(),
|
55 |
x="nr_invalid_trades",
|
56 |
y="title",
|
57 |
hue="title",
|