Skip to content

Commit

Permalink
fixing pandas warning
Browse files Browse the repository at this point in the history
  • Loading branch information
GrGLeo committed Nov 16, 2024
1 parent d82b49b commit a19b412
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion front/front_pages/2_Analytics.py
Original file line number Diff line number Diff line change
Expand Up @@ -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("""
Expand Down
6 changes: 3 additions & 3 deletions front/metrics.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,22 +13,22 @@ 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)


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']

Expand Down
6 changes: 3 additions & 3 deletions front/user/user.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit a19b412

Please sign in to comment.