ArcGIS Developer

ArcGIS API for Python

Download the samples Try it live

Which college district has the fewest low-income families?

A pilot program was run by a local cable operator in the county to provide low-cost computers and Internet access to low-income families with kids in high school. This showed a marked improvement in school performance for these kids, and the program has brought the company a fair amount of positive publicity and goodwill in the community.

Company officials now want to set up a similar program for community college students. The company provides Internet access to the five community college districts in the county, and officials are aware that the colleges are under a lot of pressure - they are facing funding cuts at the same time as increased demand for enrollment. To try to improve the situation the colleges are turning more and more to distance learning, primarily via the Internet. By providing computers and Internet access, the cable company can enable more low-income students to take advantage of online classes.

This case study uses ArcGIS API for Python to find districts that have the fewest low income families in order to empower these students.

We will use summarize_within tool to get the number of low-income families within each community district. We will also visualize this using the map widget.

Connect to your ArcGIS Online organization

We first establish a connection to our organization which could be an ArcGIS Online organization or an ArcGIS Enterprise. To be able to run the code using ArcGIS API for Python, we will need to provide credentials of a user within an ArcGIS Online organization.

In [1]:
from arcgis.gis import GIS
import pandas as pd
In [2]:
gis = GIS('home')

Get data for analysis

In [3]:
san_diego_data ='title:CommunityCollege_CensusTracts owner:api_data_owner', 
                                 'Feature layer',
In [4]:
[<Item title:"CommunityCollege_CensusTracts" type:Feature Layer Collection owner:api_data_owner>]
In [5]:
from IPython.display import display

for item in san_diego_data:
Feature Layer Collection by api_data_owner
Last Modified: April 11, 2020
0 comments, 3 views
In [6]:
san_diego_item = san_diego_data[0] # get first item from the list of items
In [7]:
for lyr in san_diego_item.layers:

Since the item is a Feature Layer Collection, accessing the layers property will give us a list of Feature Layers.

In [8]:
census_tract_income = san_diego_item.layers[0]
In [9]:
community_college_dist = san_diego_item.layers[1] 
In [10]:
m1 ='San Diego')
In [11]:
In [12]:
m2 ='San Diego')