Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
Database Management System Project
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Bouchaira Neirouz
Database Management System Project
Commits
91d57eac
Commit
91d57eac
authored
7 months ago
by
Bouchaira Neirouz
Browse files
Options
Downloads
Patches
Plain Diff
fin de l'interface
parent
3816183d
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
streamlit_app.py
+24
-1
24 additions, 1 deletion
streamlit_app.py
with
24 additions
and
1 deletion
streamlit_app.py
+
24
−
1
View file @
91d57eac
...
...
@@ -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
:
.
2
f
}
)
'
)
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
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment