data.py
def update(self):
        """
        Overwrite existing data with new ones downloaded from volby.cz by __fetch_data().
        Data is downloaded for all NUTS units separately due to the limitation on server site.
        :return:
        """

        # It there was a change, then without a diff it is cheaper (and much faster) to delete everything
        # and extract again.
        # possible improvements: Keep hashes of already downloaded files.
        # If newly downloaded file has the same hash, I don't need to extract it
        self.df.drop(self.df.index, inplace=True)
        self.df = pd.DataFrame(data={})

        # Multithreading helps a lot here.
        # ~ 2.717305s - with multithreading
        # ~ 18.856571s - without multithreading
        # still very slow though
        # print("Downloading data...")

        pool = ThreadPool(processes=32)
        multiple_results = [pool.apply_async(
            Data.__fetch_data, (self, nuts)) for nuts in NUTS]
        [self.__add_to_dataframe(res.get(timeout=10)) for res in multiple_results]

        #print("\n{} entries imported".format(len(self.df)))

        Overwrite existing data with new ones downloaded from volby.cz by __fetch_data().
        Data is downloaded for all NUTS units separately due to the limitation on server site.
        :return:
        
Overwrite existing data with new ones downloaded from volby.cz by __fetch_data().
Data is downloaded for all NUTS units separately due to the limitation on server site.
Overwrite existing data with new ones downloaded from volby . cz by __fetch_data () . Data is downloaded for all NUTS units separately due to the limitation on server site .
def update(self):
        self.df.drop(self.df.index, inplace=True)
        self.df = pd.DataFrame(data={})
        pool = ThreadPool(processes=32)
        multiple_results = [pool.apply_async(
            Data.__fetch_data, (self, nuts)) for nuts in NUTS]
        [self.__add_to_dataframe(res.get(timeout=10)) for res in multiple_results]
def update ( self ) : self . df . drop ( self . df . index , inplace = True ) self . df = pd . DataFrame ( data = { } ) pool = ThreadPool ( processes = 32 ) multiple_results = [ pool . apply_async ( Data . __fetch_data , ( self , nuts ) ) for nuts in NUTS ] [ self . __add_to_dataframe ( res . get ( timeout = 10 ) ) for res in multiple_results ]
Overwrite existing data with new ones downloaded from volby.cz by __fetch_data().
Overwrite existing data with new ones downloaded from volby . cz by __fetch_data () .
"""
        Overwrite existing data with new ones downloaded from volby.cz by __fetch_data().
        Data is downloaded for all NUTS units separately due to the limitation on server site.
        :return:
        """ # It there was a change, then without a diff it is cheaper (and much faster) to delete everything # and extract again. # possible improvements: Keep hashes of already downloaded files. # If newly downloaded file has the same hash, I don't need to extract it # Multithreading helps a lot here. # ~ 2.717305s - with multithreading # ~ 18.856571s - without multithreading # still very slow though # print("Downloading data...") #print("\n{} entries imported".format(len(self.df)))
None
self