script that displays coffees sold by hour at lca2015. Currently it opens a .json file and converts it into a python dict.
In [40]:
import json
import os
import pandas
In [22]:
opcvs = open('/home/wcmckee/Downloads/convertcsv.json', 'r')
In [23]:
opzrd = opcvs.read()
In [24]:
jdunp = json.loads(opzrd)
In [25]:
valia = []
In [41]:
pandas.read_json(jdunp)
In [27]:
jdunp.count(int)
Out[27]:
In [47]:
len(jdunp)
Out[47]:
ok if i cycle through jdunp between 0 and 23 i get the results.
cycle through ints but as a string. must add ' '
In [67]:
for numtwn in range(0,24):
print "'" + str(numtwn) + "'"
In [71]:
for jdr in jdunp:
print jdr['0']
In [74]:
for numtwn in range(0,24):
print "'" + str(numtwn) + "'"
In [29]:
for dej in jdunp:
print dej.values()
valia.append(dej.values())
In [30]:
dezrand = len(valia)
In [31]:
azlis = []
In [32]:
for vals in valia:
print vals
azlis.append(vals)
I need to filter the - - from the results. I really only need the values that have numbers.
Take number in brackets away from number not in brackets. The number in brackets is total amount of coffees sold. The number not in brackets is amount of volchers used. The number that I get when i take away is the coffee sold without volchers.
New dict that shows only the times that coffee were sold and the amount of coffgfges that were solf. Maybe that would works.
In [33]:
betra = []
In [34]:
for azl in azlis:
betra.append(azl)
In [35]:
anoe = []
anez = []
In [36]:
for betr in betra:
betr.append(anoe)
In [37]:
for deta in betr:
#print deta
if '- -' in deta:
print deta
else:
anez.append(deta)
In [38]:
fdic = []
In [ ]:
In [39]:
for resut in anez:
print resut
fdic.append(resut)
How come it is only adding the wednesday data in the results. It needs to have all the datas.
Needs to take the number in brackets away from the number not in brackets.
In [20]:
fdic
Out[20]:
In [84]:
In [84]:
In [ ]: