Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
I
inventario
Overview
Overview
Details
Activity
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
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jose Luis Gordillo Ruiz
inventario
Commits
1f23ea1b
Commit
1f23ea1b
authored
Jan 30, 2025
by
Jose Luis Gordillo Ruiz
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
afinamos los titulos en ejes de algunas figuras
parent
592f4d73
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
11 deletions
+23
-11
estadisticas.py
+23
-11
No files found.
estadisticas.py
View file @
1f23ea1b
...
...
@@ -16,15 +16,18 @@ server = flask.Flask(__name__)
def
datavis
(
datos
):
medidas
=
[
"imc"
,
"age"
,
"glucose"
,
"hba1c"
,
"ct"
,
"hdl"
]
fig
=
make_subplots
(
rows
=
2
,
cols
=
3
,
shared_xaxes
=
True
,
vertical_spacing
=
0.1
,
subplot_titles
=
medidas
)
fig
=
make_subplots
(
rows
=
2
,
cols
=
3
,
vertical_spacing
=
0.25
)
lcol
=
1
lrow
=
1
seq
=
1
for
medida
in
medidas
:
fig
.
add_trace
(
go
.
Scatter
(
x
=
datos
[
"id"
],
y
=
datos
[
medida
],
name
=
medida
,
mode
=
"markers"
),
row
=
lrow
,
col
=
lcol
)
fig
[
'layout'
][
'xaxis'
+
str
(
seq
)][
'title'
]
=
'Patient ID'
fig
[
'layout'
][
'yaxis'
+
str
(
seq
)][
'title'
]
=
medida
seq
=
seq
+
1
lrow
=
lrow
+
(
lcol
//
3
)
lcol
=
lcol
+
1
if
lcol
<
3
else
1
fig
.
update_layout
(
showlegend
=
False
)
...
...
@@ -32,17 +35,20 @@ def datavis(datos):
def
popdist
(
datos
):
medidas
=
[
"imc"
,
"age"
,
"glucose"
,
"hba1c"
,
"ct"
,
"hdl"
]
# remo
v
emos outliers
fig
=
make_subplots
(
rows
=
2
,
cols
=
3
,
shared_yaxes
=
True
,
subplot_titles
=
medidas
)
# remoemos outliers
fig
=
make_subplots
(
rows
=
2
,
cols
=
3
,
vertical_spacing
=
0.25
)
lcol
=
1
lrow
=
1
seq
=
1
for
medida
in
medidas
:
datosfil
=
datos
[
np
.
abs
(
stats
.
zscore
(
datos
[
medida
],
nan_policy
=
'omit'
))
<
3
]
fig
.
add_trace
(
go
.
Histogram
(
x
=
datosfil
[
medida
],
name
=
medida
),
row
=
lrow
,
col
=
lcol
)
fig
[
'layout'
][
'xaxis'
+
str
(
seq
)][
'title'
]
=
medida
seq
=
seq
+
1
lrow
=
lrow
+
(
lcol
//
3
)
lcol
=
lcol
+
1
if
lcol
<
3
else
1
...
...
@@ -56,44 +62,50 @@ def popdist(datos):
def
popcorr
(
datos
):
medidas
=
[
"glucose"
,
"hba1c"
,
"ct"
,
"hdl"
,
"insuline"
]
# removemos outliers
fig
=
make_subplots
(
rows
=
2
,
cols
=
3
,
shared_yaxes
=
False
,
subplot_titles
=
medidas
)
fig
=
make_subplots
(
rows
=
2
,
cols
=
3
,
shared_yaxes
=
False
,
vertical_spacing
=
0.25
)
lcol
=
1
lrow
=
1
seq
=
1
for
medida
in
medidas
:
datosfil
=
datos
[
np
.
abs
(
stats
.
zscore
(
datos
[
medida
],
nan_policy
=
'omit'
))
<
3
]
fig
.
add_trace
(
go
.
Scatter
(
x
=
datosfil
[
"imc"
],
y
=
datosfil
[
medida
],
name
=
medida
,
mode
=
"markers"
),
row
=
lrow
,
col
=
lcol
)
fig
[
'layout'
][
'xaxis'
+
str
(
seq
)][
'title'
]
=
'IMC'
fig
[
'layout'
][
'yaxis'
+
str
(
seq
)][
'title'
]
=
medida
lrow
=
lrow
+
(
lcol
//
3
)
lcol
=
lcol
+
1
if
lcol
<
3
else
1
seq
=
seq
+
1
fig
.
update_layout
(
bargap
=
0.05
,
# gap between bars of adjacent location coordinates
bargroupgap
=
0.05
,
# gap between bars of the same location coordinates
showlegend
=
False
)
return
fig
def
imc_cat
(
datos
):
medidas
=
[
"glucose"
,
"hba1c"
,
"ct"
,
"hdl"
,
"insuline"
]
grupos
=
[
"LW"
,
"NW"
,
"OW"
,
"O-CI"
,
"O-CII"
,
"O-CIII"
]
datos
[
"imc_cat"
]
=
pd
.
cut
(
datos
[
"imc"
],
bins
=
[
0
,
18
,
25
,
30
,
35
,
40
,
100
],
labels
=
grupos
)
fig
=
make_subplots
(
rows
=
2
,
cols
=
3
,
shared_yaxes
=
False
,
subplot_titles
=
medidas
)
grupos
=
[
"LW"
,
"NW"
,
"OW"
,
"O-CI"
,
"O-CII"
]
datos
[
"imc_cat"
]
=
pd
.
cut
(
datos
[
"imc"
],
bins
=
[
0
,
18
,
25
,
30
,
35
,
40
],
labels
=
grupos
)
fig
=
make_subplots
(
rows
=
2
,
cols
=
3
,
shared_yaxes
=
False
,
vertical_spacing
=
0.25
)
lcol
=
1
lrow
=
1
seq
=
1
for
medida
in
medidas
:
datosfil
=
datos
.
groupby
(
"imc_cat"
)[
medida
]
.
mean
()
fig
.
add_trace
(
go
.
Scatter
(
x
=
grupos
,
y
=
datosfil
,
name
=
medida
),
row
=
lrow
,
col
=
lcol
)
fig
[
'layout'
][
'yaxis'
+
str
(
seq
)][
'title'
]
=
medida
lrow
=
lrow
+
(
lcol
//
3
)
lcol
=
lcol
+
1
if
lcol
<
3
else
1
seq
=
seq
+
1
fig
.
update_layout
(
showlegend
=
False
...
...
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