Skip to content

Commit 6fa263e

Browse files
committed
Small updates to address dataframe consistency
1 parent 4017e89 commit 6fa263e

File tree

5 files changed

+273
-10
lines changed

5 files changed

+273
-10
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
2+
__pycache__/Data.cpython-38.pyc

.ipynb_checkpoints/Data Samples-checkpoint.ipynb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@
1919
"source": [
2020
"server = 'ftis-sql-6sdi6m3zgoyc4.database.windows.net'\n",
2121
"database = 'FTIS-db-6sdi6m3zgoyc4'\n",
22-
"username = \n",
23-
"password = \n",
22+
"username = 'FTISAdmin'\n",
23+
"password = 'Rockwell@12345'\n",
2424
"table_name = 'FTEG_Data'\n",
2525
"dm = Data.Data(server,database,username,password,table_name)\n",
2626
"tags = ['CookieLine.Mixer.CycleTime.Temperature','CookieLine.Mixer.CycleTime.Humidity','CookieLine.Mixer.MachineUDT.ActualWeight']\n"

Data Samples.ipynb

Lines changed: 265 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"cells": [
33
{
44
"cell_type": "code",
5-
"execution_count": null,
5+
"execution_count": 1,
66
"metadata": {},
77
"outputs": [],
88
"source": [
@@ -13,29 +13,287 @@
1313
},
1414
{
1515
"cell_type": "code",
16-
"execution_count": null,
16+
"execution_count": 2,
1717
"metadata": {},
1818
"outputs": [],
1919
"source": [
2020
"server = 'ftis-sql-6sdi6m3zgoyc4.database.windows.net'\n",
2121
"database = 'FTIS-db-6sdi6m3zgoyc4'\n",
22-
"username = \n",
23-
"password = \n",
22+
"username = 'FTISAdmin'\n",
23+
"password = 'Rockwell@12345'\n",
2424
"table_name = 'FTEG_Data'\n",
2525
"dm = Data.Data(server,database,username,password,table_name)\n",
2626
"tags = ['CookieLine.Mixer.CycleTime.Temperature','CookieLine.Mixer.CycleTime.Humidity','CookieLine.Mixer.MachineUDT.ActualWeight']\n"
2727
]
2828
},
2929
{
3030
"cell_type": "code",
31-
"execution_count": null,
31+
"execution_count": 3,
3232
"metadata": {},
33-
"outputs": [],
33+
"outputs": [
34+
{
35+
"name": "stdout",
36+
"output_type": "stream",
37+
"text": [
38+
"success\n"
39+
]
40+
}
41+
],
3442
"source": [
35-
"df = dm.GetWideHistory('06/21/2021 07:50:00','06/22/2021 10:00:00',5,tags)\n",
43+
"df = dm.GetWideHistory('06/21/2021 07:50:00','06/22/2021 10:00:00',1,tags)\n",
3644
"\n"
3745
]
3846
},
47+
{
48+
"cell_type": "code",
49+
"execution_count": 4,
50+
"metadata": {},
51+
"outputs": [
52+
{
53+
"data": {
54+
"text/html": [
55+
"<div>\n",
56+
"<style scoped>\n",
57+
" .dataframe tbody tr th:only-of-type {\n",
58+
" vertical-align: middle;\n",
59+
" }\n",
60+
"\n",
61+
" .dataframe tbody tr th {\n",
62+
" vertical-align: top;\n",
63+
" }\n",
64+
"\n",
65+
" .dataframe thead th {\n",
66+
" text-align: right;\n",
67+
" }\n",
68+
"</style>\n",
69+
"<table border=\"1\" class=\"dataframe\">\n",
70+
" <thead>\n",
71+
" <tr style=\"text-align: right;\">\n",
72+
" <th>ModelID</th>\n",
73+
" <th>CookieLine.Mixer.CycleTime.Humidity</th>\n",
74+
" <th>CookieLine.Mixer.CycleTime.Temperature</th>\n",
75+
" <th>CookieLine.Mixer.MachineUDT.ActualWeight</th>\n",
76+
" </tr>\n",
77+
" </thead>\n",
78+
" <tbody>\n",
79+
" <tr>\n",
80+
" <th>count</th>\n",
81+
" <td>981.000000</td>\n",
82+
" <td>981.000000</td>\n",
83+
" <td>981.000000</td>\n",
84+
" </tr>\n",
85+
" <tr>\n",
86+
" <th>mean</th>\n",
87+
" <td>66.491467</td>\n",
88+
" <td>85.281993</td>\n",
89+
" <td>7.451801</td>\n",
90+
" </tr>\n",
91+
" <tr>\n",
92+
" <th>std</th>\n",
93+
" <td>8.123004</td>\n",
94+
" <td>8.248974</td>\n",
95+
" <td>2.670140</td>\n",
96+
" </tr>\n",
97+
" <tr>\n",
98+
" <th>min</th>\n",
99+
" <td>57.585049</td>\n",
100+
" <td>68.695114</td>\n",
101+
" <td>4.517151</td>\n",
102+
" </tr>\n",
103+
" <tr>\n",
104+
" <th>25%</th>\n",
105+
" <td>59.281273</td>\n",
106+
" <td>78.904289</td>\n",
107+
" <td>5.550373</td>\n",
108+
" </tr>\n",
109+
" <tr>\n",
110+
" <th>50%</th>\n",
111+
" <td>64.094307</td>\n",
112+
" <td>87.391701</td>\n",
113+
" <td>7.031407</td>\n",
114+
" </tr>\n",
115+
" <tr>\n",
116+
" <th>75%</th>\n",
117+
" <td>72.511841</td>\n",
118+
" <td>92.614311</td>\n",
119+
" <td>11.046537</td>\n",
120+
" </tr>\n",
121+
" <tr>\n",
122+
" <th>max</th>\n",
123+
" <td>83.537560</td>\n",
124+
" <td>94.944702</td>\n",
125+
" <td>12.273960</td>\n",
126+
" </tr>\n",
127+
" </tbody>\n",
128+
"</table>\n",
129+
"</div>"
130+
],
131+
"text/plain": [
132+
"ModelID CookieLine.Mixer.CycleTime.Humidity \\\n",
133+
"count 981.000000 \n",
134+
"mean 66.491467 \n",
135+
"std 8.123004 \n",
136+
"min 57.585049 \n",
137+
"25% 59.281273 \n",
138+
"50% 64.094307 \n",
139+
"75% 72.511841 \n",
140+
"max 83.537560 \n",
141+
"\n",
142+
"ModelID CookieLine.Mixer.CycleTime.Temperature \\\n",
143+
"count 981.000000 \n",
144+
"mean 85.281993 \n",
145+
"std 8.248974 \n",
146+
"min 68.695114 \n",
147+
"25% 78.904289 \n",
148+
"50% 87.391701 \n",
149+
"75% 92.614311 \n",
150+
"max 94.944702 \n",
151+
"\n",
152+
"ModelID CookieLine.Mixer.MachineUDT.ActualWeight \n",
153+
"count 981.000000 \n",
154+
"mean 7.451801 \n",
155+
"std 2.670140 \n",
156+
"min 4.517151 \n",
157+
"25% 5.550373 \n",
158+
"50% 7.031407 \n",
159+
"75% 11.046537 \n",
160+
"max 12.273960 "
161+
]
162+
},
163+
"execution_count": 4,
164+
"metadata": {},
165+
"output_type": "execute_result"
166+
}
167+
],
168+
"source": [
169+
"df.describe()"
170+
]
171+
},
172+
{
173+
"cell_type": "code",
174+
"execution_count": 5,
175+
"metadata": {},
176+
"outputs": [
177+
{
178+
"data": {
179+
"text/html": [
180+
"<div>\n",
181+
"<style scoped>\n",
182+
" .dataframe tbody tr th:only-of-type {\n",
183+
" vertical-align: middle;\n",
184+
" }\n",
185+
"\n",
186+
" .dataframe tbody tr th {\n",
187+
" vertical-align: top;\n",
188+
" }\n",
189+
"\n",
190+
" .dataframe thead th {\n",
191+
" text-align: right;\n",
192+
" }\n",
193+
"</style>\n",
194+
"<table border=\"1\" class=\"dataframe\">\n",
195+
" <thead>\n",
196+
" <tr style=\"text-align: right;\">\n",
197+
" <th>ModelID</th>\n",
198+
" <th>CookieLine.Mixer.CycleTime.Humidity</th>\n",
199+
" <th>CookieLine.Mixer.CycleTime.Temperature</th>\n",
200+
" <th>CookieLine.Mixer.MachineUDT.ActualWeight</th>\n",
201+
" </tr>\n",
202+
" </thead>\n",
203+
" <tbody>\n",
204+
" <tr>\n",
205+
" <th>count</th>\n",
206+
" <td>981.000000</td>\n",
207+
" <td>981.000000</td>\n",
208+
" <td>981.000000</td>\n",
209+
" </tr>\n",
210+
" <tr>\n",
211+
" <th>mean</th>\n",
212+
" <td>66.491467</td>\n",
213+
" <td>85.281993</td>\n",
214+
" <td>7.451801</td>\n",
215+
" </tr>\n",
216+
" <tr>\n",
217+
" <th>std</th>\n",
218+
" <td>8.123004</td>\n",
219+
" <td>8.248974</td>\n",
220+
" <td>2.670140</td>\n",
221+
" </tr>\n",
222+
" <tr>\n",
223+
" <th>min</th>\n",
224+
" <td>57.585049</td>\n",
225+
" <td>68.695114</td>\n",
226+
" <td>4.517151</td>\n",
227+
" </tr>\n",
228+
" <tr>\n",
229+
" <th>25%</th>\n",
230+
" <td>59.281273</td>\n",
231+
" <td>78.904289</td>\n",
232+
" <td>5.550373</td>\n",
233+
" </tr>\n",
234+
" <tr>\n",
235+
" <th>50%</th>\n",
236+
" <td>64.094307</td>\n",
237+
" <td>87.391701</td>\n",
238+
" <td>7.031407</td>\n",
239+
" </tr>\n",
240+
" <tr>\n",
241+
" <th>75%</th>\n",
242+
" <td>72.511841</td>\n",
243+
" <td>92.614311</td>\n",
244+
" <td>11.046537</td>\n",
245+
" </tr>\n",
246+
" <tr>\n",
247+
" <th>max</th>\n",
248+
" <td>83.537560</td>\n",
249+
" <td>94.944702</td>\n",
250+
" <td>12.273960</td>\n",
251+
" </tr>\n",
252+
" </tbody>\n",
253+
"</table>\n",
254+
"</div>"
255+
],
256+
"text/plain": [
257+
"ModelID CookieLine.Mixer.CycleTime.Humidity \\\n",
258+
"count 981.000000 \n",
259+
"mean 66.491467 \n",
260+
"std 8.123004 \n",
261+
"min 57.585049 \n",
262+
"25% 59.281273 \n",
263+
"50% 64.094307 \n",
264+
"75% 72.511841 \n",
265+
"max 83.537560 \n",
266+
"\n",
267+
"ModelID CookieLine.Mixer.CycleTime.Temperature \\\n",
268+
"count 981.000000 \n",
269+
"mean 85.281993 \n",
270+
"std 8.248974 \n",
271+
"min 68.695114 \n",
272+
"25% 78.904289 \n",
273+
"50% 87.391701 \n",
274+
"75% 92.614311 \n",
275+
"max 94.944702 \n",
276+
"\n",
277+
"ModelID CookieLine.Mixer.MachineUDT.ActualWeight \n",
278+
"count 981.000000 \n",
279+
"mean 7.451801 \n",
280+
"std 2.670140 \n",
281+
"min 4.517151 \n",
282+
"25% 5.550373 \n",
283+
"50% 7.031407 \n",
284+
"75% 11.046537 \n",
285+
"max 12.273960 "
286+
]
287+
},
288+
"execution_count": 5,
289+
"metadata": {},
290+
"output_type": "execute_result"
291+
}
292+
],
293+
"source": [
294+
"dm.Wide_df.describe()"
295+
]
296+
},
39297
{
40298
"cell_type": "code",
41299
"execution_count": null,

Data.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,5 +62,8 @@ def GetWideHistory(self,start,end,resolution,tags):
6262
if resolution == 0:
6363
return self.Wide_df
6464
else:
65-
return self.Wide_df.resample(f'{resolution}min').ffill()
65+
df = self.Wide_df.resample(f'{resolution}min').ffill()
66+
self.Wide_df = df
67+
return self.Wide_df
68+
6669

__pycache__/Data.cpython-38.pyc

85 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)