Skip to content

Commit 7028d6b

Browse files
committed
Demo notebook for loading static data
1 parent 163b064 commit 7028d6b

File tree

1 file changed

+135
-0
lines changed

1 file changed

+135
-0
lines changed
Lines changed: 135 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,135 @@
1+
{
2+
"cells": [
3+
{
4+
"cell_type": "markdown",
5+
"metadata": {
6+
"deletable": true,
7+
"editable": true
8+
},
9+
"source": [
10+
"# This demo notebook shows how you can load datasets for testing scripts.\n",
11+
"\n",
12+
"Opengrid comes with anonymous datasets gathered from dozens of (Belgian) dwellings. These dwellings have automatic meter reading for electricity, gas and or water. The data is resampled to minute values and can be loaded as shown below. "
13+
]
14+
},
15+
{
16+
"cell_type": "code",
17+
"execution_count": null,
18+
"metadata": {
19+
"collapsed": false,
20+
"deletable": true,
21+
"editable": true
22+
},
23+
"outputs": [],
24+
"source": [
25+
"import pandas as pd\n",
26+
"import charts\n",
27+
"%matplotlib inline\n",
28+
"import matplotlib.pyplot as plt\n",
29+
"plt.rcParams['figure.figsize'] = 14,8"
30+
]
31+
},
32+
{
33+
"cell_type": "markdown",
34+
"metadata": {},
35+
"source": [
36+
"The data is stored in the folder */data*. Let's see what is available."
37+
]
38+
},
39+
{
40+
"cell_type": "code",
41+
"execution_count": null,
42+
"metadata": {
43+
"collapsed": false,
44+
"deletable": true,
45+
"editable": true
46+
},
47+
"outputs": [],
48+
"source": [
49+
"ls /data"
50+
]
51+
},
52+
{
53+
"cell_type": "markdown",
54+
"metadata": {},
55+
"source": [
56+
"We load the hourly values for electricity "
57+
]
58+
},
59+
{
60+
"cell_type": "code",
61+
"execution_count": null,
62+
"metadata": {
63+
"collapsed": false,
64+
"deletable": true,
65+
"editable": true
66+
},
67+
"outputs": [],
68+
"source": [
69+
"df_elec = pd.read_pickle('/data/electricity_2016_hour.pickle')\n",
70+
"df_elec.info()"
71+
]
72+
},
73+
{
74+
"cell_type": "markdown",
75+
"metadata": {
76+
"deletable": true,
77+
"editable": true
78+
},
79+
"source": [
80+
"We generate an interactive plot of the first 5 sensors for April 2016."
81+
]
82+
},
83+
{
84+
"cell_type": "code",
85+
"execution_count": null,
86+
"metadata": {
87+
"collapsed": false,
88+
"deletable": true,
89+
"editable": true
90+
},
91+
"outputs": [],
92+
"source": [
93+
"df = df_elec.iloc[:,:5].loc['20160401':'20160501',:]\n",
94+
"charts.plot(df, stock=True, show='inline')"
95+
]
96+
},
97+
{
98+
"cell_type": "markdown",
99+
"metadata": {},
100+
"source": [
101+
"You can try to load and plot the other data yourself :-)"
102+
]
103+
},
104+
{
105+
"cell_type": "code",
106+
"execution_count": null,
107+
"metadata": {
108+
"collapsed": true
109+
},
110+
"outputs": [],
111+
"source": []
112+
}
113+
],
114+
"metadata": {
115+
"kernelspec": {
116+
"display_name": "Python 3",
117+
"language": "python",
118+
"name": "python3"
119+
},
120+
"language_info": {
121+
"codemirror_mode": {
122+
"name": "ipython",
123+
"version": 3
124+
},
125+
"file_extension": ".py",
126+
"mimetype": "text/x-python",
127+
"name": "python",
128+
"nbconvert_exporter": "python",
129+
"pygments_lexer": "ipython3",
130+
"version": "3.5.2"
131+
}
132+
},
133+
"nbformat": 4,
134+
"nbformat_minor": 0
135+
}

0 commit comments

Comments
 (0)