cyberosa commited on
Commit
1e8b30d
·
1 Parent(s): dac33fe

filter very old markets from the mean graph

Browse files
Files changed (1) hide show
  1. tabs/dist_gap.py +6 -1
tabs/dist_gap.py CHANGED
@@ -2,7 +2,7 @@ import pandas as pd
2
  import gradio as gr
3
  import matplotlib.pyplot as plt
4
  import seaborn as sns
5
- from datetime import datetime, UTC
6
  import plotly.express as px
7
 
8
  HEIGHT = 300
@@ -60,6 +60,11 @@ def get_avg_gap_time_evolution_grouped_markets(all_markets: pd.DataFrame) -> gr.
60
  recent_markets["creation_date"] = pd.to_datetime(
61
  recent_markets["creation_datetime"]
62
  ).dt.date
 
 
 
 
 
63
  avg_dist_gap_perc = (
64
  recent_markets.groupby(["sample_date", "creation_date"])["dist_gap_perc"]
65
  .mean()
 
2
  import gradio as gr
3
  import matplotlib.pyplot as plt
4
  import seaborn as sns
5
+ from datetime import datetime, UTC, date
6
  import plotly.express as px
7
 
8
  HEIGHT = 300
 
60
  recent_markets["creation_date"] = pd.to_datetime(
61
  recent_markets["creation_datetime"]
62
  ).dt.date
63
+ # Define the cutoff date
64
+ cutoff_date = date(2024, 1, 1)
65
+
66
+ # Filter the DataFrame with very old markets
67
+ recent_markets = recent_markets[recent_markets["creation_date"] > cutoff_date]
68
  avg_dist_gap_perc = (
69
  recent_markets.groupby(["sample_date", "creation_date"])["dist_gap_perc"]
70
  .mean()