Skip to content
Snippets Groups Projects
Commit 91d57eac authored by Bouchaira Neirouz's avatar Bouchaira Neirouz
Browse files

fin de l'interface

parent 3816183d
No related branches found
No related tags found
No related merge requests found
......@@ -67,7 +67,8 @@ with tab3:
if employe is None:
st.write("")
else:
if employees[int(employe.split(" - ")[0]) - 1][3] == 1:
df_employees = pd.DataFrame(employees, columns=[desc[0] for desc in cursor.description])
if int(df_employees[df_employees['NUMERO_EMPLOYE']==int(employe.split(" - ")[0])]['TYPE']) == 1:
cursor.execute("SELECT DATE_LUNDI, NB_HEURES FROM SALAIRE_SEMAINE WHERE NUMERO_EMPLOYE = ?", (int(employe.split(" - ")[0]),))
df=pd.DataFrame(cursor.fetchall(), columns=[desc[0] for desc in cursor.description])
st.write("Nombre d'heures travaillées par semaine pour l'employé sélectionné")
......@@ -99,6 +100,28 @@ with tab3:
df=pd.DataFrame(cursor.fetchall(), columns=[desc[0] for desc in cursor.description])
st.write("Nombre de production par semaine pour l'employé sélectionné (question 4)")
st.dataframe(df)
import matplotlib.pyplot as plt
# Filter the last 10 weeks
df['DATE_LUNDI'] = pd.to_datetime(df['DATE_LUNDI'])
last_10_weeks = df.sort_values(by='DATE_LUNDI').tail(10)
# Calculate the average production per week
average_production = last_10_weeks['NB_PRODUCTION'].mean()
# Plot the data
fig, ax = plt.subplots()
ax.plot(last_10_weeks['DATE_LUNDI'], last_10_weeks['NB_PRODUCTION'], marker='.', linestyle='-', linewidth=0.1, label='Nombre de pièces produites', color='blue')
ax.axhline(y=average_production, color='red', linestyle='--', linewidth=0.5, label=f'Moyenne ({average_production:.2f})')
ax.set_xlabel('Date', fontsize=4)
ax.set_ylabel('Nombre de pièces produites', fontsize=4)
ax.set_title('Nombre de pièces produites par semaine (dernières 10 semaines)', fontsize=4)
ax.tick_params(axis='both', which='major', labelsize=3, rotation=45)
fig.set_size_inches(3, 2)
ax.legend(fontsize=4)
# Display the plot in Streamlit
st.pyplot(fig)
with tab4:
# Fonction pour générer les lundis
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment