-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPrintwindow.py
57 lines (38 loc) · 1.05 KB
/
Printwindow.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
from firebase import firebase
import time
import pandas as pd
import numpy as np
import json
firebase = firebase.FirebaseApplication("https://capstone-2496f.firebaseio.com/", None)
result=firebase.get('/DATA TEST/',None)
df = pd.DataFrame(result)
# result2 = df[~df.stat1.str.contains("NaN")]
z = pd.DataFrame.transpose(df)
variable = list(df.columns)
x = []
final = []
def convert(s):
# initialization of string to ""
new = ""
# traverse in the string
for x in s:
new += x
# return string
return new
for i in range (0, len(z)):
y = z.iloc[i,:]
x.append(variable[i]+",")
nest = y.dropna()
for j in range (0, len(nest)):
val = nest[j]+","
n = val.replace("[","").replace("]","").replace(" ","")
x.append(n)
h=np.asarray(x)
bw=int(len(h)/len(variable))
for k in range(0,len(z)):
b = convert(h[(bw*k):(bw*(k+1))])
final.append(b)
lost = np.asarray(final)
cetak = pd.DataFrame(lost)
# directory to save csv
cetak.to_csv (r'C:\Users\BLACK\Desktop\contoh.csv')