Spaces:
Runtime error
Runtime error
James McCool
commited on
Commit
·
6b17ab6
1
Parent(s):
991d254
Refactor game rotation timeline plot to use Resource column and simplify data handling
Browse files
app.py
CHANGED
@@ -693,20 +693,15 @@ with tab5:
|
|
693 |
check_rotation = team_backlog.sort_values(by=['GAME_DATE', 'Finish'], ascending=[False, True])
|
694 |
check_rotation['Start'] = check_rotation['Start'].astype(float)
|
695 |
check_rotation['Finish'] = check_rotation['Finish'].astype(float)
|
|
|
|
|
696 |
st.write(check_rotation)
|
697 |
game_rot_stats = check_rotation.reindex(game_rot_cols,axis="columns")
|
698 |
game_rot_stats = game_rot_stats.drop_duplicates(subset='backlog_lookup')
|
699 |
|
700 |
-
|
701 |
-
x_end_vals = pd.Series(check_rotation['Finish'].tolist())
|
702 |
-
text_vals = pd.Series(check_rotation['minutes'].tolist())
|
703 |
-
y_vals = pd.Series(check_rotation['Task'].tolist())
|
704 |
-
|
705 |
-
fig = px.timeline(data_frame=check_rotation, x_start='Start', x_end='Finish', y='Task', range_x=[0,check_rotation["Finish"].max()], text='minutes')
|
706 |
|
707 |
fig.layout.xaxis.type = 'linear'
|
708 |
-
fig.data[0].x = x_start_vals
|
709 |
-
fig.data[0].y = y_vals
|
710 |
# fig.update_yaxes(autorange="reversed")
|
711 |
|
712 |
# Create a color map for each unique player
|
|
|
693 |
check_rotation = team_backlog.sort_values(by=['GAME_DATE', 'Finish'], ascending=[False, True])
|
694 |
check_rotation['Start'] = check_rotation['Start'].astype(float)
|
695 |
check_rotation['Finish'] = check_rotation['Finish'].astype(float)
|
696 |
+
check_rotation['Task'] = check_rotation['PLAYER_NAME'] + ' ' + check_rotation['delta'].astype(str)
|
697 |
+
check_rotation['Resource'] = check_rotation['PLAYER_NAME']
|
698 |
st.write(check_rotation)
|
699 |
game_rot_stats = check_rotation.reindex(game_rot_cols,axis="columns")
|
700 |
game_rot_stats = game_rot_stats.drop_duplicates(subset='backlog_lookup')
|
701 |
|
702 |
+
fig = px.timeline(data_frame=check_rotation, x_start='Start', x_end='Finish', y='Resource', range_x=[0,check_rotation["Finish"].max()])
|
|
|
|
|
|
|
|
|
|
|
703 |
|
704 |
fig.layout.xaxis.type = 'linear'
|
|
|
|
|
705 |
# fig.update_yaxes(autorange="reversed")
|
706 |
|
707 |
# Create a color map for each unique player
|