Simplified key to access dataframe.
This commit is contained in:
		
							parent
							
								
									8763f28547
								
							
						
					
					
						commit
						c646b1d80b
					
				
							
								
								
									
										10
									
								
								econ-demo.py
									
									
									
									
									
								
							
							
						
						
									
										10
									
								
								econ-demo.py
									
									
									
									
									
								
							| @ -43,7 +43,7 @@ def get_balances_over_time(names, balances, func, terms=4): | ||||
|     } | ||||
|     df = pd.DataFrame(data) | ||||
|     for t in range(1,terms): | ||||
|         key = "term%i" % t  | ||||
|         key = str(t) | ||||
|         frame = func(balances, terms=t) | ||||
|         if frame is not None: | ||||
|             df[key] = frame | ||||
| @ -66,6 +66,8 @@ def illustrate_share_of_wealth(): | ||||
|     df = get_balances_over_time ( | ||||
|         participants, balances, compounding_interest | ||||
|     ) | ||||
|     df["share"] = [val * 100 for val in calc_share_of_wealth(df["3"]) ] | ||||
|      | ||||
|     print(df.to_html()) | ||||
| 
 | ||||
|     terms = 222 | ||||
| @ -87,7 +89,7 @@ def illustrate_share_of_wealth(): | ||||
|     print("What is the share of wealth in a UBI economy?") | ||||
|     print(calc_share_of_wealth(u)) | ||||
| 
 | ||||
| # illustrate_share_of_wealth() | ||||
| illustrate_share_of_wealth() | ||||
| 
 | ||||
| def visualize_ubi(terms=25): | ||||
| 
 | ||||
| @ -122,7 +124,7 @@ def visualize_ubi(terms=25): | ||||
|         x, sow[2], color="cyan", label=participants[2] | ||||
|     ) | ||||
|     plt.axhline( | ||||
|         y=0.33, color='violet', linestyle='--' | ||||
|         y=0.33, color='violet', linestyle='--', label="0.33" | ||||
|     ) | ||||
| 
 | ||||
|     plt.title("Change in Wealth Distribution Under UBI") | ||||
| @ -168,7 +170,7 @@ def visualize_inflation(terms=50): | ||||
|         x, total_supply_ubi, color="cyan", label="UBI (n=3, du=10)" | ||||
|     ) | ||||
|     plt.plot( | ||||
|         x, total_supply_si, color="red", label="Debt (n=3, APY=5%)" | ||||
|         x, total_supply_si, color="red", label="Debt (APY=5%)" | ||||
|     ) | ||||
|     plt.title("Money Supply over Time: UBI vs Compounding Interest") | ||||
|     plt.legend() | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user