First Commit

This commit is contained in:
JYH
2022-08-16 01:39:14 +00:00
parent 47590c43b0
commit 09261fa77e

View File

@@ -1,10 +1,11 @@
from operator import itemgetter from operator import itemgetter
# convertion of Json Data to list # convertion of Json Data to list by selecting columns
state, time = list( zip(*[ (x['state'], x['last_updated']) for x in raw_data])) state, time = list( zip(*[ (x['state'], x['last_updated']) for x in raw_data]))
# another converion thorugh itemgetter (a little faster) # another converion thorugh itemgetter (a little faster)
state, time = list( zip( *map(itemgetter('state', 'last_updated'), raw_data) )) state, time = list( zip( *map(itemgetter('state', 'last_updated'), raw_data) ))
# each
state = list(map(itemgetter('state'), raw_data)) state = list(map(itemgetter('state'), raw_data))