Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
mooc-rr
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
3e6bf7b47a05a05ae3d6af86121dcb5d
mooc-rr
Commits
275baf11
Commit
275baf11
authored
Apr 10, 2020
by
François Févotte
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Ex 03-3 (suite)
parent
1188bdbe
Changes
3
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
378 additions
and
203 deletions
+378
-203
exercice.html
module3/exo3/exercice.html
+130
-113
exercice.jmd
module3/exo3/exercice.jmd
+187
-90
utils.jl
module3/exo3/utils.jl
+61
-0
No files found.
module3/exo3/exercice.html
View file @
275baf11
This diff is collapsed.
Click to expand it.
module3/exo3/exercice.jmd
View file @
275baf11
This diff is collapsed.
Click to expand it.
module3/exo3/utils.jl
0 → 100644
View file @
275baf11
# Affichage des DataFrames dans la sortie HTML
function
info
(
df
::
DataFrame
)
pretty
(
x
)
=
x
pretty
(
x
::
Float64
)
=
@sprintf
"%.6f"
x
pretty
(
::
Type
{
Union
{
T
,
Missing
}})
where
{
T
}
=
"
$
T?"
function
printrow
(
i
)
print
(
"<tr>"
)
print
(
"<th>
$
i</th>"
)
for
j
in
1
:
ncol
(
df
)
print
(
"<td>
$
(pretty(df[i,j]))</td>"
)
end
print
(
"</tr>"
)
end
function
printrows
()
i
=
1
while
i
<=
nrow
(
df
)
&&
i
<=
3
printrow
(
i
)
i
+=
1
end
i
>
nrow
(
df
)
&&
return
if
i
<
nrow
(
df
)
-
2
print
(
"<tr><td>...</td></tr>"
)
end
i
=
max
(
i
,
nrow
(
df
)
-
2
)
while
i
<=
nrow
(
df
)
printrow
(
i
)
i
+=
1
end
end
println
(
"
$
(nrow(df)) rows ×
$
(ncol(df)) columns"
)
print
(
"<table>"
)
print
(
"<thead>"
)
print
(
"<tr><th></th>"
)
for
col
in
names
(
df
)
print
(
"<th>
$
col</th>"
)
end
print
(
"</tr>"
)
print
(
"<tr><th></th>"
)
for
col
in
names
(
df
)
print
(
"<th>
$
(pretty(eltype(df[!,col])))</th>"
)
end
print
(
"</tr>"
)
print
(
"</thead>"
)
print
(
"<tbody>"
)
printrows
()
print
(
"</tbody>"
)
print
(
"</table>
\n
"
)
end
# Permet de construire des durées avec une syntaxe comme :
# 7Days
const
Years
=
Year
(
1
)
const
Days
=
Day
(
1
)
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