Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
D
DAN
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Package Registry
Container Registry
Operate
Terraform modules
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Automatic Text Recognition
DAN
Commits
04809033
Commit
04809033
authored
1 year ago
by
Manon Blanco
Committed by
Yoann Schneider
1 year ago
Browse files
Options
Downloads
Patches
Plain Diff
Round mean values calculated during data analysis
parent
aaeec5ed
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!288
Round mean values calculated during data analysis
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
dan/datasets/analyze/statistics.py
+18
-8
18 additions, 8 deletions
dan/datasets/analyze/statistics.py
with
18 additions
and
8 deletions
dan/datasets/analyze/statistics.py
+
18
−
8
View file @
04809033
# -*- coding: utf-8 -*-
import
logging
from
collections
import
Counter
,
defaultdict
from
functools
import
partial
from
pathlib
import
Path
from
typing
import
Dict
,
List
,
Optional
...
...
@@ -32,23 +33,32 @@ def create_table(
operations
=
[]
if
count
:
operations
.
append
((
"
Count
"
,
len
))
operations
.
append
((
"
Count
"
,
len
,
None
))
operations
.
extend
(
[
(
"
Min
"
,
np
.
min
),
(
"
Max
"
,
np
.
max
),
(
"
Mean
"
,
np
.
mean
),
(
"
Median
"
,
np
.
median
),
(
"
Min
"
,
np
.
min
,
None
),
(
"
Max
"
,
np
.
max
,
None
),
(
"
Mean
"
,
np
.
mean
,
2
),
(
"
Median
"
,
np
.
median
,
2
),
]
)
if
total
:
operations
.
append
((
"
Total
"
,
np
.
sum
))
operations
.
append
((
"
Total
"
,
np
.
sum
,
None
))
statistics
.
add_rows
(
[
[
col_name
,
*
list
(
map
(
operator
,
data
.
values
()))]
for
col_name
,
operator
in
operations
[
col_name
,
*
list
(
map
(
# Round values if needed
partial
(
round
,
ndigits
=
digits
),
map
(
operator
,
data
.
values
()),
)
),
]
for
col_name
,
operator
,
digits
in
operations
]
)
...
...
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