File size: 532 Bytes
c9eef1d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
import pandas as pd
import gradio as gr
import matplotlib.pyplot as plt
import seaborn as sns
from seaborn import FacetGrid
import plotly.express as px


def plot_top_best_behaviour_markets(markets_data: pd.DataFrame):
    """Function to paint the top markets with the lowest metric of distribution gap"""
    sorted_data = markets_data.sort_values(by="dist_gap_perc", ascending=False)
    top_best_markets = sorted_data[["title", "sample_datetime", "dist_gap_perc"]].head(
        5
    )
    return gr.DataFrame(top_best_markets)