diff --git a/front/front_pages/2_Analytics.py b/front/front_pages/2_Analytics.py index ff84ca4..c29ff84 100644 --- a/front/front_pages/2_Analytics.py +++ b/front/front_pages/2_Analytics.py @@ -41,7 +41,7 @@ lambda td: f"{int(td.total_seconds() // 3600):02}:{int((td.total_seconds() % 3600) // 60):02}:{int(td.total_seconds() % 60):02}" ) - st.write(shown_df, hide_index=True) + st.write(shown_df) with col2: st.markdown(""" diff --git a/front/metrics.py b/front/metrics.py index 5c46cad..544a9cf 100644 --- a/front/metrics.py +++ b/front/metrics.py @@ -13,14 +13,14 @@ def calculate_metric(df: pd.DataFrame, col: str, days: int) -> pd.DataFrame: def calculate_ctl(df: pd.DataFrame) -> pd.DataFrame: ctl_days = 42 - df['ctl'] = 0 + df['ctl'] = 0. return calculate_metric(df, 'ctl', ctl_days) def calculate_atl(df: pd.DataFrame) -> pd.DataFrame: atl_days = 7 - df['atl'] = 0 + df['atl'] = 0. return calculate_metric(df, 'atl', atl_days) @@ -28,7 +28,7 @@ def calculate_atl(df: pd.DataFrame) -> pd.DataFrame: def calculate_form(df: pd.DataFrame) -> pd.DataFrame: for i in range(len(df)): if i == 0: - df['form'] = 0 + df['form'] = 0. else: df.loc[i, 'form'] = df.loc[i - 1, 'ctl'] - df.loc[i - 1, 'atl'] diff --git a/front/user/user.py b/front/user/user.py index 1ea9e9e..36d5c36 100644 --- a/front/user/user.py +++ b/front/user/user.py @@ -133,9 +133,9 @@ def _get_query(self, table: str, select: str = "*", wkt_id: int = None, order_by def _prep_calendar(self, data: pd.DataFrame, sport: str) -> pd.DataFrame: cols = ['activity_id', 'date', 'duration'] - data = data[cols] - data['title'] = sport - data['end'] = data.apply(lambda row: row['date'] + time_to_timedelta(row['duration']), axis=1) + data = data[cols].copy() + data.loc[:, 'title'] = sport + data.loc[:, 'end'] = data.apply(lambda row: row['date'] + time_to_timedelta(row['duration']), axis=1) return data def _process_duration(self, total: pd.DataFrame) -> pd.DataFrame: