Création planning avec Gantt chart
Bonjour à tous,
Je souhaite faire une planning en utilisant « Gantt chart »
Voici le code que j'utilise pour mon test « code tuto sur internet »
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33
| from pathlib import Path
import pandas as pd
import plotly
import plotly.express as px
# import plotly.figure_factory as ff
EXCEL_FILE = Path.cwd() / "Tasks.xlsx"
# Read Dataframe from Excel file
df = pd.read_excel(EXCEL_FILE)
# Assign Columns to variables
tasks = df["Task"]
start = df["Start"]
finish = df["Finish"]
complete = df["Complete in %"]
# Create Gantt Chart
fig = px.timeline(
df, x_start=start, x_end=finish, y=tasks, color=complete, title="Task Overview"
)
# Upade/Change Layout
fig.update_xaxes(autorange="reversed")
fig.update_layout(title_font_size=42, font_size=18, title_font_family="Arial")
# Interactive Gantt
# fig = ff.create_gantt(df)
# Save Graph and Export to HTML
plotly.offline.plot(fig, filename="Task_Overview_Gantt.html") |
Cependant pour mon projet j’aurai besoin d’ajouter des heures avec la date et je bloque un peu pour la modification du code
Mon import Excel pour mon projet ressemblerait à ceci
Task |
Start date |
Start heure |
Finish date |
Finish HEURE |
test 1 |
19/07/2020 |
15:00 |
31/07/2020 |
10:00 |
test 2 |
10/07/2020 |
16:00 |
25/07/2020 |
11:00 |
test 3 |
04/07/2020 |
17:00 |
04/08/2020 |
12:00 |
test 4 |
18/07/2020 |
18:00 |
25/07/2020 |
13:00 |
Merci d'avance pour votre aide