Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Q
qbe
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
lifo
A
Anaïs Halftermeyer
queryByExample
qbe
Commits
4b1fb000
Commit
4b1fb000
authored
Sep 26, 2025
by
Elias
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
file renamed
parent
c4168778
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
41 additions
and
2 deletions
+41
-2
README.md
README.md
+2
-2
numberOfWords.py
numberOfWords.py
+39
-0
No files found.
README.md
View file @
4b1fb000
...
...
@@ -65,10 +65,10 @@ python3 frequency_grouping.py
```
### • Graphics
**
graphic
s.py :**
Bar chart to display the number of words per Bin.
**
numberOfWord
s.py :**
Bar chart to display the number of words per Bin.
```
bash
python3
graphic
s.py
python3
numberOfWord
s.py
```
**TopMotsParBin.py :**
Bar chart to display top number of word occurrences per Bin.
...
...
numberOfWords.py
0 → 100755
View file @
4b1fb000
import
csv
from
collections
import
defaultdict
import
matplotlib.pyplot
as
plt
input_file
=
"res7_Random.csv"
# Dictionnaire pour compter les lignes par Bin
bin_counts
=
defaultdict
(
int
)
with
open
(
input_file
,
mode
=
"r"
,
newline
=
""
)
as
f
:
reader
=
csv
.
reader
(
f
)
next
(
reader
)
for
row
in
reader
:
bin_value
=
int
(
row
[
4
])
# colonne 'Bin'
bin_counts
[
bin_value
]
+=
1
# Trier les bins
bins
=
sorted
(
bin_counts
.
keys
())
counts
=
[
bin_counts
[
b
]
for
b
in
bins
]
# Création du bar chart
plt
.
figure
(
figsize
=
(
10
,
6
))
bars
=
plt
.
bar
([
str
(
b
)
for
b
in
bins
],
counts
,
color
=
'skyblue'
)
# Ajouter les nombres au-dessus des barres
for
bar
in
bars
:
height
=
bar
.
get_height
()
plt
.
text
(
bar
.
get_x
()
+
bar
.
get_width
()
/
2
,
height
+
0.5
,
str
(
height
),
ha
=
'center'
,
va
=
'bottom'
,
fontsize
=
10
)
plt
.
title
(
"Number of words by Bin"
)
plt
.
xlabel
(
"Bin"
)
plt
.
ylabel
(
"Number of words"
)
plt
.
grid
(
axis
=
'y'
,
linestyle
=
'--'
,
alpha
=
0.7
)
plt
.
tight_layout
()
plt
.
show
()
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment