def __init__(self, file_nazionale, file_regioni, file_province, show=False, store=True, color_map=None, time_str=None, max_days=0): self.__showGraph = show self.__storeGraph = store self.__max_days = max_days self.__data_nazionale = DataManager.nazionale_data( file_nazionale, max_days=self.__max_days) max_data = self.__data_nazionale.data.max() self.__time_str = time_str if time_str is not None else max_data[:10].replace( "-", "") self.__data_regionale, self.__codici_regione = DataManager.regioni_data( file_regioni, max_days=self.__max_days) self.__data_provinciale = DataManager.province_data( file_province, max_days=self.__max_days) self.__color_map = self.__color_map if color_map is None else color_map
def analisi_province(self, file_province, file_regioni, output_base, generate_bars=None, show=None, store=None): print(f'Generazione grafici province al {self.__time_str}') if self.__data_regionale is None: self.__data_regionale, self.__codici_regione = DataManager.regioni_data( file_regioni) if self.__data_provinciale is None: self.__data_provinciale = DataManager.province_data(file_province) generate_bars = generate_bars if generate_bars is not None else self.__codici_regione for reg in self.__codici_regione: denominazione = ",".join( self.__data_regionale[self.__data_regionale['codice_regione'] == reg].denominazione_regione.unique()) print( f'-> Generazione grafici provinciali per regione {denominazione} al {self.__time_str}' ) values = self.__data_provinciale[ self.__data_provinciale['codice_regione'] == reg] self.__province_linear(values, output_base=output_base, show=show, store=store) self.__province_log(values, output_base=output_base, show=show, store=store) if reg in generate_bars: self.__province_increment(values, output_base=output_base, show=show, store=store)