ArcGIS Blog

Business

ArcGIS Business Analyst

ArcGIS Business Analyst in the ArcGIS API for Python!

By Joel McCune

This article is the second blog of a series of dedicated posts highlighting enhancements that were launched as a part of the ArcGIS Business Analyst Pro’s November 2021release.

ArcGIS Business Analyst is a product suite that provides access to industry-leading data, mapping, and analysis workflows to help organizations make data-based decisions. ArcGIS API for Python can be used to automate or process big data with ArcGIS Pro and with Esri’s cloud services such as data geoenrichment, geocoding, and other workflows. With thousands of global variables available for users of ArcGIS Business Analyst products, discovering variables available for geoenrichment is an important capability.

In this blog article, I will explain how the recent ArcGIS Business Analyst Pro’s November release’s enhancement allows users to easily find, sort, and use geoenrichment data—whether the Business Analyst data is used via cloud data through ArcGIS Online or ArcGIS Business Analyst Enterprise or locally installed datasets–through ArcGIS API for Python.

With ArcGIS API for Python (ver. 1.9.1) December 2021 release, it is now possible to discover demographic data available via ArcGIS Online services and a local data source. For those who are not familiar with ArcGIS Business Analyst data, depending on the product bundle purchased, it includes data accessed through cloud such as Online data and/or downloadable, local data.

Searching Local Data

When searching for downloaded, local Business Analyst data through ArcGIS API for Python, results are returned as a Pandas data frame, enabling filtering and searching to easily identify only variables needed for analysis. This capability enables and dramatically streamlines scripted demographic analysis and data science workflows.

 

 

Python API Country Introspection
Python API Country Introspection

Searching Online Data

However, if a GIS object instance is created to connect to a remote data source such as Business Analyst data accessed through ArcGIS Online, all globally available countries are returned—a total of over 150 countries(!).

ArcGIS Online Country Introspection using the Python API
ArcGIS Online Country Introspection using the Python API

Enhancement Makes Search Easier

To make it easier to view metadata and filter the available countries, get_countries can now return a Pandas data frame by passing True into the new as_df parameter. It’s also much faster!

Python API Country Introspection Returning a Data Frame
Python API Country Introspection Returning a Data Frame

New Enhancement for Using Local Data

When working with downloaded, local data, you also now can search not only the most current year, but any previous year’s data as well. This is particularly useful when you need to run a model developed against a specific year of data.

Python API County Introspection for Previous Years
Python API County Introspection for Previous Years

Enrich Variable Discovery

Thousands of variables are available for geoenrichment, so the ability to filter and search for variables is important. Fortunately, geoenrichment variables can be returned as a Pandas data frame for filtering and searching using the enrich_variables property of an instantiated Country object. Country objects are instantiated using the three-letter ISO3 identifier. Similar to searching for countries, the variables are returned as a data frame, searching, and filtering to identify a specific set of variables for subsequent geoenrichment is possible.

In the following example, I am interested in retrieving Esri-curated variables describing general socioeconomic characteristics. In general, what I am looking for are quantitative demographic variables for the current year. The first step is creating a Country object referencing the United States.

Country Object Instance Creation
Country Object Instance Creation

Once this step has been completed, I can retrieve a subset of variables for follow on analysis fitting my criteria using filtering by naming conventions. As shown, it is useful to take advantage of the regular expressions for filtering.

Filtering Enrichment Variables Using Regular Expressions
Filtering Enrichment Variables Using Regular Expressions

You may have also noticed I saved the output to a temporary feature class in memory. This is because I frequently immediately convert it to a Pandas data frame for subsequent analysis—taking advantage of the function chaining abilities of Pandas data frames to quickly clean up the data for follow on analysis.

Setting Country Source and Using Enrich Layer
Setting Country Source and Using Enrich Layer

You may have also noticed I saved the output to a temporary feature class in memory. This is because I frequently immediately convert it to a Pandas data frame for subsequent analysis—taking advantage of the function chaining abilities of Pandas data frames to quickly clean up the data for follow on analysis.

Converting Memory Feature Class to a Pandas Data Frame
Converting Memory Feature Class to a Pandas Data Frame

While only one example, it illustrates the ability to discover and filter through the staggering number of geoenrichment variables available. This example, along with others, is available in a public repository of examples you can view and use in your own work.

Additional Resources

Please visit the following links for more information regarding ArcGIS Busines Analyst:

Share this article

Subscribe
Notify of
0 Comments
Oldest
Newest
Inline Feedbacks
View all comments