In [13]:
import pandas as pd
import os
In [14]:
os.chdir('/Users/WhoaaaItsDavid/Desktop/Data Library Projects/Age Friendly Communities/')
In [15]:
alwp_df = pd.read_csv('ALWP RCFEs.csv')
alwp_df['Zipcode'] = alwp_df['Zipcode'].astype(str)
alwp_df = alwp_df[alwp_df['Facility Name'] != 'Howard House (TBI)***'] # Filter out Howard House (TBI)*** per client guidance
# Display
alwp_df
Out[15]:
In [16]:
# Create a list of unique zipcodes within San Diego County that participate in ALWP
alwp_unique_zips = list(alwp_df['Zipcode'].unique())
# Create an empty dictionary using the list of unique zipcodes
count_ALWP = {}
for unique_zipcode in alwp_unique_zips:
count_ALWP[unique_zipcode] = 0
# Find the number of RCFEs in each zipcode that participate in ALWP: count_ALWP
for unique_zipcode in alwp_unique_zips:
for all_zipcode in alwp_df['Zipcode']:
if unique_zipcode == all_zipcode:
count_ALWP[unique_zipcode] += 1
In [17]:
# Answer the question: How many of the RCFEs in a given community participate in the Assisted Living Waiver Program (ALWP)?
print('There are,', len(count_ALWP), 'unique zipcodes with RCFEs that participate in the ALWP.')
count = 1
for zipcode in sorted(count_ALWP.keys()):
print(str(count) + ')', 'Zipcode', zipcode, 'contains', count_ALWP[zipcode], 'RCFE(s).')
count += 1
In [ ]: