Skip to content

Commit

Permalink
Add amount of lines to the basic kpi query
Browse files Browse the repository at this point in the history
  • Loading branch information
alephcero committed Nov 22, 2024
1 parent fc80fb5 commit 7e2cc25
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions urbantrips/viz/viz.py
Original file line number Diff line number Diff line change
Expand Up @@ -2625,15 +2625,13 @@ def plot_basic_kpi_wrapper():
q = """
select *
from basic_kpi_by_line_hr
where dia = 'weekday'
where dia = 'weekday';
"""

if lineas_principales != "All":
q += f"limit {lineas_principales}"

q += ";"

kpi_data = pd.read_sql(q, conn_data)
if lineas_principales != "All":
top_lines = list(kpi_data.id_linea.value_counts().index[:lineas_principales])
kpi_data = kpi_data.loc[kpi_data.id_linea.isin(top_lines)]

if len(kpi_data) > 0:
kpi_data.groupby(["id_linea", "yr_mo"]).apply(
Expand Down

0 comments on commit 7e2cc25

Please sign in to comment.