change date from friday to thursday

This commit is contained in:
2024-11-20 16:20:24 +01:00
parent 1bca840477
commit 4509f7505e
2 changed files with 13 additions and 13 deletions
+13 -13
View File
@@ -14,10 +14,10 @@ from datetime import datetime
def get_data(emeis:list[str],scraper:DataScraper) -> list[pd.DataFrame]: def get_data(emeis:list[str],scraper:DataScraper) -> list[pd.DataFrame]:
dataframes = [] dataframes = []
for imei in tqdm(emeis,ascii=True,desc="gather_data"): for imei in tqdm(emeis,ascii=True,desc="gather_data"):
resp = json.loads(scraper.get_data(imei,history_length=90)["response"].decode("utf-8"))["data"] resp = json.loads(scraper.get_data(imei,history_length=90)["response"].decode("utf-8"))["data"]
df = pd.DataFrame(resp) df = pd.DataFrame(resp)
df['MeasurementTime'] = pd.to_datetime(df['MeasurementTime']) #fix time date df['MeasurementTime'] = pd.to_datetime(df['MeasurementTime']) #fix time date
dataframes.append(df) dataframes.append(df)
return dataframes return dataframes
@@ -75,7 +75,7 @@ Sv5 static
""" """
Supposedly this script will only be run on friday. Supposedly this script will only be run on friday.
DO NOT RUN IT ON ANY OTHER DAY THAN FRIDAY!!! DO NOT RUN IT ON ANY OTHER DAY THAN THURSDAY!!!
""" """
if __name__ == "__main__": if __name__ == "__main__":
pd.options.mode.copy_on_write = True pd.options.mode.copy_on_write = True
@@ -100,16 +100,16 @@ if __name__ == "__main__":
days = {"vr":[],"za":[],"zo":[],"ma":[],"di":[],"wo":[],"do":[]} days = {"vr":[],"za":[],"zo":[],"ma":[],"di":[],"wo":[],"do":[]}
for count in counts_per_day: for count in counts_per_day:
str_count_list = [str(elem) for elem in list(count)] str_count_list = [str(elem) for elem in list(count)]
for i,day in enumerate(["vr","za","zo","ma","di","wo","do"]): for i,day in enumerate(["do","vr","za","zo","ma","di","wo"]):
days[day].append(str_count_list[i]) days[day].append(str_count_list[i])
img = fill_column(days["vr"],0,img) img = fill_column(days["do"],0,img)
img = fill_column(days["za"],1,img) img = fill_column(days["vr"],1,img)
img = fill_column(days["zo"],2,img) img = fill_column(days["za"],2,img)
img = fill_column(days["ma"],3,img) img = fill_column(days["zo"],3,img)
img = fill_column(days["di"],4,img) img = fill_column(days["ma"],4,img)
img = fill_column(days["wo"],5,img) img = fill_column(days["di"],5,img)
img = fill_column(days["do"],6,img) img = fill_column(days["wo"],6,img)
# plt.imshow(img) # plt.imshow(img)
# plt.show() # plt.show()
img.save("report.pdf") img.save("report.pdf")
Binary file not shown.