test view keys
This commit is contained in:
parent
e935a50d1d
commit
5d0912aa84
13
data-view.py
13
data-view.py
@ -18,18 +18,19 @@ root_dir = "/home/tonydero/projects/weather-pydash/"
|
||||
|
||||
sensors_dict = pd.read_pickle(root_dir+"output/saved_sensors_dict.pkl")
|
||||
none_dict = nan2None(sensors_dict)
|
||||
none_df = pd.DataFrame(none_dict)
|
||||
print(none_dict.keys())
|
||||
# none_df = pd.DataFrame(none_dict)
|
||||
|
||||
with open(root_dir+'output/none_dict.json', 'w', encoding='utf-8') as f:
|
||||
json.dump(none_dict, f, ensure_ascii=False, indent=4)
|
||||
# with open(root_dir+'output/none_dict.json', 'w', encoding='utf-8') as f:
|
||||
# json.dump(none_dict, f, ensure_ascii=False, indent=4)
|
||||
|
||||
# sensors_df = pd.DataFrame(sensors_dict)
|
||||
|
||||
# sensors_df.T.to_csv("sensors_df.csv")
|
||||
# print(datetime.now().strftime("%s"))
|
||||
none_df.T.to_csv(root_dir+"output/none_df.csv")
|
||||
# none_df.T.to_csv(root_dir+"output/none_df.csv")
|
||||
|
||||
none_read_df = pd.read_csv(root_dir+"output/none_df.csv")
|
||||
print(none_read_df)
|
||||
# none_read_df = pd.read_csv(root_dir+"output/none_df.csv")
|
||||
# print(none_read_df)
|
||||
# concat_df = pd.concat([none_read_df, none_read_df], ignore_index=True)
|
||||
# print(concat_df.tail())
|
||||
|
7
data.py
7
data.py
@ -21,6 +21,7 @@ def convert_int(value):
|
||||
return None
|
||||
|
||||
|
||||
root_dir = "/home/tonydero/projects/weather-pydash/"
|
||||
sensors_url = "http://192.168.1.221/get_livedata_info"
|
||||
|
||||
sensors_response = requests.get(sensors_url)
|
||||
@ -36,7 +37,7 @@ broom_dict = sensors_dict['ch_aisle'][4]
|
||||
lightning_dict = sensors_dict['lightning'][0]
|
||||
|
||||
try:
|
||||
with open('/home/tonydero/projects/weather-pydash/output/saved_sensors_dict.pkl', 'rb') as f:
|
||||
with open(root_dir+'output/saved_sensors_dict.pkl', 'rb') as f:
|
||||
sensors_dict = pickle.load(f)
|
||||
except:
|
||||
sensors_dict = {}
|
||||
@ -69,7 +70,7 @@ datum_dict['lghtng_batt'] = convert_int(lightning_dict['battery'])
|
||||
|
||||
sensors_dict[datetime.now()] = datum_dict
|
||||
|
||||
with open('/home/tonydero/projects/weather-pydash/output/saved_sensors_dict.pkl', 'wb') as f:
|
||||
with open(root_dir+'output/saved_sensors_dict.pkl', 'wb') as f:
|
||||
pickle.dump(sensors_dict, f)
|
||||
with open('/home/tonydero/projects/weather-pydash/output/saved_sensors_dict.json', 'w', encoding='utf-8') as f:
|
||||
with open(root_dir+'output/saved_sensors_dict.json', 'w', encoding='utf-8') as f:
|
||||
json.dump(sensors_dict, f, ensure_ascii=False, indent=4)
|
||||
|
Loading…
Reference in New Issue
Block a user