""" A file that contains some helpers functions """ from typing import IO import pandas as pd import plotly.express as px from plotly.graph_objs._figure import Figure def load_data(file: IO) -> tuple[str , str]: global df df = pd.read_csv(file.name) return df.head().to_html(), f"Rows: {df.shape[0]}, Cols: {df.shape[1]}" def show_summary() -> str: if df is None: return "Please upload a dataset first." return df.describe().to_html() def plot_column(colname: str) -> Figure | str: if df is None: return "Please upload a dataset first." fig = px.histogram(df, x=colname) return fig