enter image description here下面是我使用Python Plotly创建甘特的代码。我需要用独特的颜色掩盖所有的树叶或假期。
我期待着这样的画面
df = pd.read_excel('Project Priority List.xlsx')df.columns = df.iloc[0]
#Remove the first row, which is now the header
df = df[1:]
#Optionally, reset the index
df.reset_index(drop=True, inplace=True)
Modelling = {'Oscar','Parvathy Anil','Pavan','Puru','Senthil','Vel','Vetrivel','Subramanian'}MO = {'Anju','Naveen','Parvathy M','Shaima','Manikandan','Saranya'}
Modelling_Team = df[df['WnS POC'].isin(Modelling)]MO_Team = df[df['WnS POC'].isin(MO)]Modelling_Team.reset_index(drop=True, inplace=True)MO_Team.reset_index(drop=True, inplace=True)
filter_condition = Modelling_Team['Active Task'].str.contains('Active|Leave', case=False, na=False)
#Apply the filter condition to the DataFrame
dff = Modelling_Team[filter_condition]
fig = px.timeline(dff, x_start='Start Date', x_end='Planned Due Date', y='Project (Scope)', color='WnS POC', title='Gantt Chart', hover_data=['Project Name', 'Priority'])
#Configure the Gantt chart layout
#fig.update_yaxes(categoryorder='total ascending')fig.update_xaxes(title_text='Timeline')
#Enable zooming and panning for detailed viewing
fig.update_xaxes(rangeslider_visible=True)fig.update_yaxes(autorange="reversed")fig.update_layout(xaxis=dict(type="date"))
#Show the Gantt chart
fig.show()
pio.write_html(fig, file='timeline_center image description herehart.html')
1条答案
按热度按时间p8ekf7hl1#
以下是我为我的问题找到的答案: