Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
MLAir
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
esde
machine-learning
MLAir
Commits
70670eb3
Commit
70670eb3
authored
4 years ago
by
Felix Kleinert
Browse files
Options
Downloads
Patches
Plain Diff
include .tex table:'station_describe_short'
parent
1aec0e47
No related branches found
No related tags found
3 merge requests
!226
Develop
,
!225
Resolve "release v1.2.0"
,
!194
Resolve "Inclue new IntelliO3 plots in MLAir"
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
mlair/run_modules/pre_processing.py
+26
-5
26 additions, 5 deletions
mlair/run_modules/pre_processing.py
with
26 additions
and
5 deletions
mlair/run_modules/pre_processing.py
+
26
−
5
View file @
70670eb3
...
@@ -128,15 +128,36 @@ class PreProcessing(RunEnvironment):
...
@@ -128,15 +128,36 @@ class PreProcessing(RunEnvironment):
df
.
sort_index
(
inplace
=
True
)
df
.
sort_index
(
inplace
=
True
)
df
=
df
.
reindex
(
df
.
index
.
drop
([
"
# Stations
"
,
"
# Samples
"
]).
to_list
()
+
[
"
# Stations
"
,
"
# Samples
"
],
)
df
=
df
.
reindex
(
df
.
index
.
drop
([
"
# Stations
"
,
"
# Samples
"
]).
to_list
()
+
[
"
# Stations
"
,
"
# Samples
"
],
)
df
.
index
.
name
=
'
stat. ID
'
df
.
index
.
name
=
'
stat. ID
'
column_format
=
self
.
create_column_format_for_tex
(
df
)
df
.
to_latex
(
os
.
path
.
join
(
path
,
"
station_sample_size.tex
"
),
na_rep
=
'
---
'
,
column_format
=
column_format
)
df
.
to_markdown
(
open
(
os
.
path
.
join
(
path
,
"
station_sample_size.md
"
),
mode
=
"
w
"
,
encoding
=
'
utf-8
'
),
tablefmt
=
"
github
"
)
df_nometa
=
df
.
drop
(
meta_data
,
axis
=
1
)
df_nometa
.
to_latex
(
os
.
path
.
join
(
path
,
"
station_sample_size_short.tex
"
),
na_rep
=
'
---
'
,
column_format
=
column_format
)
df_descr
=
df_nometa
.
iloc
[:
-
2
].
astype
(
'
float32
'
).
describe
(
percentiles
=
[.
05
,
.
1
,
.
25
,
.
5
,
.
75
,
.
9
,
.
95
]).
astype
(
'
int32
'
)
df_descr
=
pd
.
concat
([
df_nometa
.
loc
[[
'
# Samples
'
]],
df_descr
]).
T
df_descr
.
rename
(
columns
=
{
"
# Samples
"
:
"
no. samples
"
,
"
count
"
:
"
no. stations
"
},
inplace
=
True
)
df_descr_colnames
=
list
(
df_descr
.
columns
)
df_descr_colnames
=
[
df_descr_colnames
[
1
]]
+
[
df_descr_colnames
[
0
]]
+
df_descr_colnames
[
2
:]
df_descr
=
df_descr
[
df_descr_colnames
]
column_format
=
self
.
create_column_format_for_tex
(
df_descr
)
df_descr
.
to_latex
(
os
.
path
.
join
(
path
,
"
station_describe_short.tex
"
),
na_rep
=
'
---
'
,
column_format
=
column_format
)
@staticmethod
def
create_column_format_for_tex
(
df
:
pd
.
DataFrame
)
->
str
:
"""
Creates column format for latex table based on the shape of a given DataFrame.
Calculates number of columns and uses
'
c
'
as column position. First element is set to
'
l
'
, last to
'
r
'
"""
column_format
=
np
.
repeat
(
'
c
'
,
df
.
shape
[
1
]
+
1
)
column_format
=
np
.
repeat
(
'
c
'
,
df
.
shape
[
1
]
+
1
)
column_format
[
0
]
=
'
l
'
column_format
[
0
]
=
'
l
'
column_format
[
-
1
]
=
'
r
'
column_format
[
-
1
]
=
'
r
'
column_format
=
''
.
join
(
column_format
.
tolist
())
column_format
=
''
.
join
(
column_format
.
tolist
())
df
.
to_latex
(
os
.
path
.
join
(
path
,
"
station_sample_size.tex
"
),
na_rep
=
'
---
'
,
column_format
=
column_format
)
return
column_format
df
.
to_markdown
(
open
(
os
.
path
.
join
(
path
,
"
station_sample_size.md
"
),
mode
=
"
w
"
,
encoding
=
'
utf-8
'
),
tablefmt
=
"
github
"
)
df
.
drop
(
meta_data
,
axis
=
1
).
to_latex
(
os
.
path
.
join
(
path
,
"
station_sample_size_short.tex
"
),
na_rep
=
'
---
'
,
column_format
=
column_format
)
def
split_train_val_test
(
self
)
->
None
:
def
split_train_val_test
(
self
)
->
None
:
"""
"""
...
...
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