Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import turtle | |
import random | |
def draw_s(t, size=100, start=(0, 0), rel_gap=2): | |
""" | |
Draw the 90's S using turtle. | |
Parameters | |
---------- | |
t: turtle object |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# list to hold plot objects | |
plot_list = [] | |
# loop through each year, creating a plot | |
for year in range(2018, 2028): | |
# advance calculators a year | |
calc.advance_to_year(year) | |
calc.calc_all() | |
calc_base.advance_to_year(year) | |
calc_base.calc_all() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def plot(cds_list, year): | |
def ticker(): | |
""" | |
function used to create the y-axis labels in the plot | |
""" | |
if tick == 25: | |
return 'All Taxpayers' | |
elif tick == 21: | |
return '$1M or more' | |
elif tick == 18.75: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def find_perc(data, bin_name): | |
# find percentatge for each type of effect | |
sum_wt = data.s006.sum() | |
# tax liability decrease of > $500 | |
large_cut = tc.zsum(data.s006[data['change'] < -500]) / float(sum_wt) | |
# tax liability decrease of $100-500 | |
small_cut = tc.zsum(data.s006[(data['change'] >= -500) & (data['change'] <= -100)]) / float(sum_wt) | |
# tax liability change of less than $100 | |
no_change = tc.zsum(data.s006[(data['change'] > -100) & (data['change'] < 100)]) / float(sum_wt) | |
# tax liability increase of $100-500 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
rec = tc.Records(data='../Tax-Calculator/puf.csv') | |
pol = tc.Policy() | |
calc_base = tc.Calculator(records=rec, policy=pol) | |
calc_base.advance_to_year(2018) | |
calc_base.calc_all() | |
records = tc.Records(data='../Tax-Calculator/puf.csv') | |
policy = tc.Policy() | |
calc = tc.Calculator(records=records, policy=policy) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from bokeh.plotting import figure | |
from bokeh.io import show, output_notebook | |
from bokeh.models import ColumnDataSource, Legend, FuncTickFormatter, NumeralTickFormatter | |
from bokeh.layouts import column | |
import taxcalc as tc | |
import pandas as pd | |
import numpy as np | |
import copy | |
output_notebook() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
This script retreaves information on homeless services facilities from | |
http://opendata.dc.gov/datasets/homeless-service-facilities | |
""" | |
import requests | |
import pandas as pd | |
api_url = 'https://maps2.dcgis.dc.gov/dcgis/rest/services/DCGIS_DATA/Public_Service_WebMercator/MapServer/6/query?where=1%3D1&outFields=*&outSR=4326&f=json' | |
raw_data = requests.get(api_url) |