From 2408c7a963e3d516a983ee8bb2976f794f0b676c Mon Sep 17 00:00:00 2001 From: Erick Ahmed Date: Tue, 14 Jul 2026 00:37:47 +0200 Subject: [PATCH] Use better function names --- stat/frequency.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/stat/frequency.py b/stat/frequency.py index 4c3d9bc..70d8002 100644 --- a/stat/frequency.py +++ b/stat/frequency.py @@ -23,7 +23,7 @@ def _format_can_id(x): return s.upper() -def calc_freq(df: pd.DataFrame) -> pd.DataFrame: +def calculate_frequency(df: pd.DataFrame) -> pd.DataFrame: """Calculates frequency counts and percentages for identifiers.""" can_id_col = 'ID' if 'ID' in df.columns else 'Identifier' @@ -36,7 +36,7 @@ def calc_freq(df: pd.DataFrame) -> pd.DataFrame: freq_df['Percentage'] = (freq_df['Count'] / total * 100).round(2) return freq_df.sort_values('Count', ascending=True) -def plot_freq(stats_df: pd.DataFrame, title: str) -> go.Figure: +def plot_frequency(stats_df: pd.DataFrame, title: str) -> go.Figure: """Generates interactive horizontal bar chart with log x-axis.""" fig = px.bar( stats_df, y='Identifier', x='Count', orientation='h', title=title, log_x=True, @@ -123,8 +123,8 @@ if __name__ == "__main__": args = parser.parse_args() df = load_data(args.input) - stats = calc_freq(df) - fig = plot_freq(stats, title=args.title) + stats = calculate_frequency(df) + fig = plot_frequency(stats, title=args.title) config = { 'responsive': True, 'displaylogo': False,