I wrote code in python that works slow. Because I am new to python, I am not sure that I am doing everything right. My question is what I can do optimally? About the problem: I have 25 *.json files, each is about 80 MB. Each file just contain json strings. I need make some histogram based on data.
In this part I want create list of all dictionaries ( one dictionary represent json object):
d = [] # filename is list of name of files
for x in filename:
d.extend(map(json.loads, open(x)))
then I want to create list u
:
u = []
for x in d:
s = x['key_1'] # s is sting which I use to get useful value
t1 = 60*int(s[11:13]) + int(s[14:16])# t1 is useful value
u.append(t1)
Now I am creating histogram:
plt.hist(u, bins = (max(u) - min(u)))
plt.show()
Any thought and suggestions are appreciated. Thank you!