コード例 #1
0
    def set_mortality(self, data):
        print("Fitting mortality distribution")
        mortality_data = list(data.values())
        r = []
        for i in range(len(mortality_data)):
            deaths = mortality_data[i]
            for _ in range(deaths):
                r.append(i)

        dist = Distribution()
        dist.Fit(r)

        self.mortality_distribution = dist
コード例 #2
0
 def set_migrations(self, data):
     print("Fitting migration distribution")
     
     r = []
     for i in range(len(data)):
         num = data[i]
         for _ in range(num):
             r.append(i)
             
     dist = Distribution()
     dist.min_val = 0
     dist.max_val = len(data) - 1
     dist.Fit(r)
     
     self.migrations_distribution = dist
コード例 #3
0
    def set_natality(self, data):
        print("Fitting natality distribution")
        data.pop('total_births', None)
        
        r = []
        for i in range(len(data)):
            key = list(data.keys())[i]
            num = int(data[key])
            for _ in range(num):
                r.append(i)

        dist = Distribution()
        dist.Fit(r)
        
        self.natality_distribution = dist