%config InlineBackend.figure_formats = ['svg']
from IPython.display import display, Markdown
import matplotlib.pyplot as plt
import seaborn as sns
set()
sns."whitegrid")
sns.set_style(import random
import numpy as np
import pandas as pd
Danish weather
Import some plotting libraries and set some defaults:
Here is some computation:
= 150
nr_project_days = pd.DataFrame({'day': list(range(nr_project_days)),
df 'wind': [random.random()+1 for i in range(nr_project_days)],
'precipitation': [random.random()+1 for i in range(nr_project_days)]})
df
day | wind | precipitation | |
---|---|---|---|
0 | 0 | 1.747650 | 1.115449 |
1 | 1 | 1.452317 | 1.134909 |
2 | 2 | 1.783481 | 1.239925 |
3 | 3 | 1.837637 | 1.460844 |
4 | 4 | 1.308335 | 1.890218 |
... | ... | ... | ... |
145 | 145 | 1.801730 | 1.499466 |
146 | 146 | 1.434560 | 1.981628 |
147 | 147 | 1.394330 | 1.913791 |
148 | 148 | 1.122685 | 1.730421 |
149 | 149 | 1.478548 | 1.712684 |
150 rows × 3 columns
Weather data
Weather data was collected… blah, blah, blah, blah, blah, blah, blah, blah, blah, blah, blah, blah, blah, blah, blah, blah, blah, blah
= df.melt(id_vars=['day'], value_vars=['wind', 'precipitation'], var_name='weather', value_name='value')
long_format long_format
day | weather | value | |
---|---|---|---|
0 | 0 | wind | 1.747650 |
1 | 1 | wind | 1.452317 |
2 | 2 | wind | 1.783481 |
3 | 3 | wind | 1.837637 |
4 | 4 | wind | 1.308335 |
... | ... | ... | ... |
295 | 145 | precipitation | 1.499466 |
296 | 146 | precipitation | 1.981628 |
297 | 147 | precipitation | 1.913791 |
298 | 148 | precipitation | 1.730421 |
299 | 149 | precipitation | 1.712684 |
300 rows × 3 columns
=long_format, x='day', y='value', hue='weather')
sns.lineplot(data=0) ; plt.ylim(bottom
From this plot, it seems Danish weather is quite unpredictable.