Skip to content

Commit 94e95d3

Browse files
author
Andrew DiBiasio
committed
Fixed Issue #239: Off by one day in charts and csv files
1 parent 94f2845 commit 94e95d3

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

src/penn_chime/models.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -296,7 +296,7 @@ def build_dispositions_df(
296296

297297
def build_admits_df(dispositions_df: pd.DataFrame) -> pd.DataFrame:
298298
"""Build admits dataframe from dispositions."""
299-
admits_df = dispositions_df.iloc[:-1, :] - dispositions_df.shift(1)
299+
admits_df = dispositions_df.iloc[:, :] - dispositions_df.shift(1)
300300
admits_df.day = dispositions_df.day
301301
admits_df.date = dispositions_df.date
302302
return admits_df

src/penn_chime/presentation.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -327,7 +327,7 @@ def display_sidebar(st, d: Parameters) -> Parameters:
327327
docs_url=DOCS_URL
328328
)
329329
)
330-
n_days = n_days_input() + 1 # Overcome zero index error with panda df
330+
n_days = n_days_input()
331331
max_y_axis_set = max_y_axis_set_input()
332332

333333
max_y_axis = None
@@ -472,7 +472,7 @@ def write_footer(st):
472472

473473

474474
def display_download_link(st, filename: str, df: pd.DataFrame):
475-
csv = dataframe_to_base64(df[:-1]) # Overcome zero index error with panda df
475+
csv = dataframe_to_base64(df)
476476
st.markdown(
477477
"""
478478
<a download="{filename}" href="data:file/csv;base64,{csv}">Download {filename}</a>

0 commit comments

Comments
 (0)