Use better function names
This commit is contained in:
+4
-4
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user