Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
ufesk
bda-analytics-challenge-template
Commits
ea881256
Commit
ea881256
authored
Jul 12, 2021
by
tills
Browse files
Hallo Sophia
parent
90d06782
Changes
1
Hide whitespace changes
Inline
Side-by-side
notebooks/4. Visualization/Lockdown.ipynb
View file @
ea881256
%% Cell type:code id: tags:
```
python
import
pandas
as
pd
import
numpy
as
np
import
matplotlib.pyplot
as
plt
import
os
import
scipy
import
seaborn
as
sns
```
%% Cell type:code id: tags:
```
python
file
=
os
.
getcwd
()
file_m
=
file
[
0
:(
len
(
file
)
-
9
)]
file_dz
=
'data
\\
modeling
\\
train'
file_data
=
file_m
+
file_dz
data_name
=
os
.
listdir
(
file_data
)
data
=
'train_data'
file_number
=
file_m
+
file_dz
+
'
\\
'
+
data
+
'.txt'
df
=
pd
.
read_csv
(
file_number
)
df
[
"collection_intervall"
]
=
list
(
map
(
lambda
st
:
str
(
st
)[
0
:
int
(
st
.
index
(
"d"
))],
df
[
"last_collection"
]))
df
[
"collection_intervall"
]
=
df
[
"collection_intervall"
].
astype
(
int
)
df
[
"collection_intervall"
]
=
list
(
map
(
lambda
z
:
z
*
(
-
1
),
df
[
"collection_intervall"
]))
df
[
'lockdown'
]
=
list
(
map
(
lambda
z
:
'Ja'
if
z
==
1
else
'Nein'
,
df
[
'Lockdown'
]))
df
```
%%%% Output: execute_result
Unnamed: 0 Unnamed: 0.1 timestamp container_id \
0 0 0 2020-05-22 18:51:01.742945 70B3D500700016DA
1 1 1 2020-06-05 14:49:42.681218 70B3D500700016DA
2 2 2 2020-06-29 13:47:52.050553 70B3D500700016DA
3 3 3 2020-07-17 13:46:18.287249 70B3D500700016DA
4 4 4 2020-08-07 09:44:36.149679 70B3D500700016DA
.. ... ... ... ...
627 4381 4381 2020-08-08 15:42:32.866709 70B3D50070001786
628 4382 4382 2020-08-09 15:42:30.118122 70B3D50070001786
629 4383 4383 2020-08-11 12:42:24.962069 70B3D50070001786
630 4384 4384 2020-09-07 13:40:11.695782 70B3D50070001786
631 4385 4385 2020-09-14 15:39:33.709211 70B3D50070001786
last_collection pre_height post_height \
0 -14 days +06:00:58.208000 136 16
1 -14 days +04:01:19.058000 120 14
2 -24 days +01:01:50.633000 136 14
3 -18 days +00:01:33.806000 128 12
4 -21 days +04:01:42.126000 118 14
.. ... ... ...
627 -2 days +21:00:01.687000 64 28
628 -1 days +00:00:02.748000 60 24
629 -2 days +03:00:05.138000 70 30
630 -28 days +23:02:13.362000 62 30
631 -8 days +22:00:37.993000 64 28
sensor_mean_temperature sensor_max_temperature sensor_min_temperature \
0 15.251029 47 0
1 16.410714 44 4
2 18.255446 43 4
3 19.053476 45 7
4 21.981524 47 6
.. ... ... ...
627 33.296296 59 16
628 32.217391 60 15
629 28.121951 60 15
630 20.341463 55 7
631 20.869281 44 6
... weather_max_moisture weather_min_moisture holiday_percentage \
0 ... 95.0 25.0 0.360606
1 ... 93.0 19.0 0.361446
2 ... 97.0 25.0 0.375652
3 ... 96.0 22.0 0.222222
4 ... 95.0 20.0 0.288000
.. ... ... ... ...
627 ... 64.0 23.0 0.592593
628 ... 75.0 21.0 1.000000
629 ... 69.0 23.0 0.177778
630 ... 98.0 28.0 0.295840
631 ... 94.0 26.0 0.282353
Lockdown year month weekday collection_intervall number_collections \
0 0.0 2020 5 4 14 1
1 0.0 2020 6 4 14 1
2 0.0 2020 6 0 24 1
3 0.0 2020 7 4 18 1
4 0.0 2020 8 4 21 1
.. ... ... ... ... ... ...
627 0.0 2020 8 5 2 1
628 0.0 2020 8 6 1 1
629 0.0 2020 8 1 2 1
630 0.0 2020 9 0 28 1
631 0.0 2020 9 0 8 1
lockdown
0 Nein
1 Nein
2 Nein
3 Nein
4 Nein
.. ...
627 Nein
628 Nein
629 Nein
630 Nein
631 Nein
[632 rows x 27 columns]
%% Cell type:code id: tags:
```
python
X_train
=
pd
.
DataFrame
({
'pre_height'
:
df
[
'pre_height'
],
'collection_intervall'
:
df
[
'collection_intervall'
],
'Lockdown'
:
df
[
'lockdown'
]})
```
%% Cell type:code id: tags:
```
python
g
=
sns
.
jointplot
(
data
=
X_train
,
x
=
'collection_intervall'
,
y
=
'pre_height'
,
hue
=
'Lockdown'
,
height
=
10
)
g
.
ax_joint
.
set_xlabel
(
'Sammulungs Intervall'
,
fontweight
=
'bold'
)
g
.
ax_joint
.
set_ylabel
(
'Höhe vor Leerung'
,
fontweight
=
'bold'
)
g
.
ax_joint
.
set_title
(
'Auswirkungen Lockdown auf Höhe vor Leerung und Sammlungs Intervall'
,
fontweight
=
'bold'
)
```
%%%% Output: execute_result
Text(0.5, 1.0, 'Auswirkungen Lockdown auf Höhe vor Leerung und Sammlungs Intervall')
%%%% Output: display_data

%% Cell type:code id: tags:
```
python
# hallo Sophia
```
...
...
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