<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Faxi Yuan, PhD on Medium]]></title>
        <description><![CDATA[Stories by Faxi Yuan, PhD on Medium]]></description>
        <link>https://medium.com/@ds-faxi-yuan?source=rss-104f31c5e11b------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*6_ZpTV56JuiqKsGPugivgQ.jpeg</url>
            <title>Stories by Faxi Yuan, PhD on Medium</title>
            <link>https://medium.com/@ds-faxi-yuan?source=rss-104f31c5e11b------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 21 Nov 2026 02:24:25 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@ds-faxi-yuan/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[I’m moving all my Medium content to Substack in the next week!]]></title>
            <link>https://medium.com/@ds-faxi-yuan/im-moving-all-my-medium-content-to-substack-in-the-next-week-a2b1ebf576ef?source=rss-104f31c5e11b------2</link>
            <guid isPermaLink="false">https://medium.com/p/a2b1ebf576ef</guid>
            <dc:creator><![CDATA[Faxi Yuan, PhD]]></dc:creator>
            <pubDate>Wed, 02 Oct 2024 00:42:43 GMT</pubDate>
            <atom:updated>2024-10-02T00:42:43.488Z</atom:updated>
            <content:encoded><![CDATA[<p><strong>Hey everyone!</strong></p><p>In a week, I’ll be moving all my content from Medium to <a href="https://faxiyuandsai.substack.com/">Substack</a>. Subscribe for free, or opt for a paid subscription to unlock exclusive content and insights!</p><p>Thanks for your support, and enjoy the start of fall!</p><p>Faxi Yuan</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a2b1ebf576ef" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How I Transitioned from Civil Engineering to Data Science]]></title>
            <link>https://medium.com/@ds-faxi-yuan/how-i-transitioned-from-civil-engineering-to-data-science-c2ec117bc727?source=rss-104f31c5e11b------2</link>
            <guid isPermaLink="false">https://medium.com/p/c2ec117bc727</guid>
            <category><![CDATA[data-science-tutorial]]></category>
            <category><![CDATA[data-science-transition]]></category>
            <dc:creator><![CDATA[Faxi Yuan, PhD]]></dc:creator>
            <pubDate>Tue, 03 Sep 2024 00:37:33 GMT</pubDate>
            <atom:updated>2024-09-03T00:38:43.413Z</atom:updated>
            <content:encoded><![CDATA[<p>I’m sharing my journey of transitioning into data science within the pharmaceutical industry from a non-tech background in civil and construction engineering. Whether you’re contemplating a similar career shift or looking to incorporate data science and AI into your graduate research, I hope my experience provides some inspiration and guidance.</p><h3><strong>Introduction</strong></h3><p>Hello! I’m Faxi Yuan, with a Master’s and Ph.D. in Civil and Construction Engineering. After spending 1.5 years as a postdoc researcher, I made the leap into the data science industry, landing my first role as a Senior Data Scientist in insurance. Today, I’m a Sr. Manager of Data Science and AI Solutions in the pharmaceutical sector.</p><h3><strong>1. Why Did I Transition into Data Science?</strong></h3><h4><strong><em>1.1 TL; DR version:</em></strong></h4><ol><li><strong>Limited Practical Impact</strong>: My research in civil engineering, despite producing valuable insights, wasn’t translating into real-world applications.</li><li><strong>Passion for Data Science and AI</strong>: I was drawn to the potential of data science to solve business problems and create tangible impact.</li></ol><h4><strong><em>1.2 Detailed version</em></strong></h4><p>My journey began with a PhD at the University of Florida, where I focused on AI and big data for disaster response and urban resilience. After that, I had a 1.5-year postdoc researcher experience at the Texas A&amp;M University, continuing my research in urban AI resilience, publishing papers and drafting grant proposals. While I published several papers and contributed to the academic field (<a href="https://scholar.google.com/citations?user=BNA36HsAAAAJ&amp;hl=en">Google Scholar</a>), I soon realized that my work wasn’t being applied practically by organizations like FEMA or urban planning departments. This gap between research and real-world application left me frustrated, and I am considering moving into industry to make more practical implementations with knowledge and skills.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rWfxw732RQz5k4AR3zJLmQ.png" /><figcaption>Figure 1. Screenshot of my Google Scholar</figcaption></figure><p>During my research, I developed strong skills in data science and AI, using methods like Naive Bayes, SVM, tree-based methods (e.g., decision tree, random forest and AdaBoost), and graph neural networks. The more I delved into these areas, the more fascinated I became with their ability to solve complex problems. I realized that the fast-paced advancements in data science offered endless opportunities to make a real impact on business, driving my decision to transition into the industry as a data scientist.</p><h3>2. How did I land my first &amp; current data science job?</h3><p>The answer will be threefold: 1) <strong><em>Solid Foundation in Machine Learning</em></strong>: My academic experience gave me a deep understanding of ML methods, which was crucial in securing my first data science job in an insurance company, particularly my experiences in graph neural networks was well appreciated as the employer was planning a use case of using such method. 2) <strong><em>Relevant Domain Expertise</em></strong>: My background in civil engineering and experience in natural hazard modeling and damage estimation with claim data were highly relevant to the insurance industry. 3) <strong><em>Business Understanding</em></strong>: With 2-year industrial data scientist experiences in an insurance company, I have gained the skill of better understanding in business issues, and integration of data science with business needs. My ability to bridge technical skills with business needs enabled me to navigate different domains, leading to my current role at BMS in the pharmaceutical sector.</p><h3>3. <strong>Challenges I Faced and How I Overcame Them</strong></h3><h4><strong><em>3.1 Python: Data Preprocessing and Wrangling</em></strong></h4><p>In industry, data is often raw and complex, requiring extensive cleaning and manipulation. To tackle this, I immersed myself in Python libraries like Pandas and Numpy, practiced with public datasets on Kaggle, and watched instructional videos on YouTube to hone my skills.</p><h4><strong><em>3.2 SQL/Spark: Handling Big Data</em></strong></h4><p>Working with large datasets stored in formats like Parquet required mastering SQL and Spark. I studied official documentations, completed online courses, and practiced with public datasets like Amazon Reviews and the Yelp Open Dataset to build proficiency in these tools.</p><h4><strong><em>3.3 Machine Learning: Bridging the Gap with Business Sense</em></strong></h4><p>The toughest challenge I faced was aligning machine learning models with real business needs. It’s not enough to understand algorithms — you also have to grasp what matters most to the business. I honed this skill by diving into industry case studies and collaborating closely with business stakeholders. Through this process, I learned how to define the right business questions, choose the appropriate machine learning models, and crucially, balance technical performance metrics with business outcomes to ensure our solutions delivered real value.</p><h3>4. <strong>What’s next?</strong></h3><p>I’m now focused on creating a study plan for those looking to transition into data science from non-tech backgrounds. Whether you’re a professional in a traditional industry considering a switch to data science, a graduate researcher wanting to integrate AI into your work, or simply someone curious about data science, I’ll be sharing tutorials and insights on Medium, LinkedIn, and GitHub.</p><p><strong><em>Stay Connected</em></strong>: Follow me on <a href="http://yuan/">Medium</a>, <a href="https://www.linkedin.com/in/faxi-yuan-bb2167104/">LinkedIn </a>and <a href="https://github.com/fyuan1014">GitHub </a>to track my updates and learn more about how to break into the data science field. I will create my learning tutorial on GitHub, and then share it by my Medium and LinkedIn.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c2ec117bc727" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Graph Neural Networks (GNNs): When Will GCNs and GraphSAGE Fail?]]></title>
            <description><![CDATA[<div class="medium-feed-item"><p class="medium-feed-image"><a href="https://medium.com/@ds-faxi-yuan/graph-neural-networks-gnns-when-will-gcn-and-graphsage-fail-3eb1adcd54a4?source=rss-104f31c5e11b------2"><img src="https://cdn-images-1.medium.com/max/1294/1*wckT2NO2Sfrxd0lfftf7fA.png" width="1294"></a></p><p class="medium-feed-snippet">In my previous stories, I have talked about how graph convolutional networks (GCNs) was inspired by CNNs, and what are the layer&#x2026;</p><p class="medium-feed-link"><a href="https://medium.com/@ds-faxi-yuan/graph-neural-networks-gnns-when-will-gcn-and-graphsage-fail-3eb1adcd54a4?source=rss-104f31c5e11b------2">Continue reading on Medium »</a></p></div>]]></description>
            <link>https://medium.com/@ds-faxi-yuan/graph-neural-networks-gnns-when-will-gcn-and-graphsage-fail-3eb1adcd54a4?source=rss-104f31c5e11b------2</link>
            <guid isPermaLink="false">https://medium.com/p/3eb1adcd54a4</guid>
            <category><![CDATA[graph-neural-networks]]></category>
            <dc:creator><![CDATA[Faxi Yuan, PhD]]></dc:creator>
            <pubDate>Tue, 04 Jul 2023 21:33:46 GMT</pubDate>
            <atom:updated>2023-07-04T21:44:13.835Z</atom:updated>
        </item>
        <item>
            <title><![CDATA[Graph Neural Networks (GNNs): Layers of Graph Convolutional Networks (GCNs), GraphSAGE, and Graph…]]></title>
            <description><![CDATA[<div class="medium-feed-item"><p class="medium-feed-image"><a href="https://medium.com/@ds-faxi-yuan/graph-neural-networks-gnns-introduction-of-gnn-layers-of-graph-convolutional-networks-gcns-8f9f4ac082d4?source=rss-104f31c5e11b------2"><img src="https://cdn-images-1.medium.com/max/1382/1*ujFfV3Jst80x0Cj3oBF3og.png" width="1382"></a></p><p class="medium-feed-snippet">Today, I will introduce how each layer of three classical Graph Neural Networks (GNNs) architectures works, such as Graph Convolutional&#x2026;</p><p class="medium-feed-link"><a href="https://medium.com/@ds-faxi-yuan/graph-neural-networks-gnns-introduction-of-gnn-layers-of-graph-convolutional-networks-gcns-8f9f4ac082d4?source=rss-104f31c5e11b------2">Continue reading on Medium »</a></p></div>]]></description>
            <link>https://medium.com/@ds-faxi-yuan/graph-neural-networks-gnns-introduction-of-gnn-layers-of-graph-convolutional-networks-gcns-8f9f4ac082d4?source=rss-104f31c5e11b------2</link>
            <guid isPermaLink="false">https://medium.com/p/8f9f4ac082d4</guid>
            <category><![CDATA[graph-neural-networks]]></category>
            <dc:creator><![CDATA[Faxi Yuan, PhD]]></dc:creator>
            <pubDate>Sat, 10 Jun 2023 22:17:07 GMT</pubDate>
            <atom:updated>2023-06-11T15:38:19.393Z</atom:updated>
        </item>
        <item>
            <title><![CDATA[Graph Neural Networks (GNNs): Comparison between CNNs and GNNs]]></title>
            <description><![CDATA[<div class="medium-feed-item"><p class="medium-feed-image"><a href="https://medium.com/@ds-faxi-yuan/graph-neural-networks-gnn-comparison-between-cnn-and-gnn-5c97fdfb3e31?source=rss-104f31c5e11b------2"><img src="https://cdn-images-1.medium.com/max/1309/1*4hB6aXgym_0VZswTQXx3nw.png" width="1309"></a></p><p class="medium-feed-snippet">Based on my previous story on message passing framework for node classifications, I am going to introduce the graph neural networks (GNN)&#x2026;</p><p class="medium-feed-link"><a href="https://medium.com/@ds-faxi-yuan/graph-neural-networks-gnn-comparison-between-cnn-and-gnn-5c97fdfb3e31?source=rss-104f31c5e11b------2">Continue reading on Medium »</a></p></div>]]></description>
            <link>https://medium.com/@ds-faxi-yuan/graph-neural-networks-gnn-comparison-between-cnn-and-gnn-5c97fdfb3e31?source=rss-104f31c5e11b------2</link>
            <guid isPermaLink="false">https://medium.com/p/5c97fdfb3e31</guid>
            <category><![CDATA[graph-neural-networks]]></category>
            <dc:creator><![CDATA[Faxi Yuan, PhD]]></dc:creator>
            <pubDate>Mon, 29 May 2023 21:40:23 GMT</pubDate>
            <atom:updated>2023-05-30T14:41:32.189Z</atom:updated>
        </item>
        <item>
            <title><![CDATA[Graph Learning: Message Passing for Node Classifications]]></title>
            <description><![CDATA[<div class="medium-feed-item"><p class="medium-feed-image"><a href="https://medium.com/@ds-faxi-yuan/graph-learning-message-passing-for-node-classifications-7f042c349763?source=rss-104f31c5e11b------2"><img src="https://cdn-images-1.medium.com/max/1604/1*D7mqERKpj_28v16H5-YDQA.png" width="1604"></a></p><p class="medium-feed-snippet">Introduction</p><p class="medium-feed-link"><a href="https://medium.com/@ds-faxi-yuan/graph-learning-message-passing-for-node-classifications-7f042c349763?source=rss-104f31c5e11b------2">Continue reading on Medium »</a></p></div>]]></description>
            <link>https://medium.com/@ds-faxi-yuan/graph-learning-message-passing-for-node-classifications-7f042c349763?source=rss-104f31c5e11b------2</link>
            <guid isPermaLink="false">https://medium.com/p/7f042c349763</guid>
            <category><![CDATA[network-science]]></category>
            <category><![CDATA[graph-data-science]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[classification-problem]]></category>
            <dc:creator><![CDATA[Faxi Yuan, PhD]]></dc:creator>
            <pubDate>Sun, 09 Apr 2023 01:24:54 GMT</pubDate>
            <atom:updated>2023-04-09T15:24:02.606Z</atom:updated>
        </item>
        <item>
            <title><![CDATA[Graph analytics: PageRank for product recommendation]]></title>
            <description><![CDATA[<div class="medium-feed-item"><p class="medium-feed-image"><a href="https://medium.com/@ds-faxi-yuan/graph-analytics-pagerank-for-product-recommendation-a05d9e57ad4c?source=rss-104f31c5e11b------2"><img src="https://cdn-images-1.medium.com/max/1648/1*O8_ny3gWLvbgRxljQ1z04A.png" width="1648"></a></p><p class="medium-feed-snippet">Assuming we have a bipartite graph for a user-product shopping website as shown in Figure 1, we know the user i interacts with product 6&#x2026;</p><p class="medium-feed-link"><a href="https://medium.com/@ds-faxi-yuan/graph-analytics-pagerank-for-product-recommendation-a05d9e57ad4c?source=rss-104f31c5e11b------2">Continue reading on Medium »</a></p></div>]]></description>
            <link>https://medium.com/@ds-faxi-yuan/graph-analytics-pagerank-for-product-recommendation-a05d9e57ad4c?source=rss-104f31c5e11b------2</link>
            <guid isPermaLink="false">https://medium.com/p/a05d9e57ad4c</guid>
            <category><![CDATA[graph-data-science]]></category>
            <category><![CDATA[recommendation-system]]></category>
            <category><![CDATA[machine-learning]]></category>
            <dc:creator><![CDATA[Faxi Yuan, PhD]]></dc:creator>
            <pubDate>Sat, 18 Mar 2023 23:27:53 GMT</pubDate>
            <atom:updated>2023-04-09T13:07:42.018Z</atom:updated>
        </item>
        <item>
            <title><![CDATA[Use Case of Causal Inference for Price Elasticity in Automobile Insurance]]></title>
            <description><![CDATA[<div class="medium-feed-item"><p class="medium-feed-snippet">Alert: Here you can see a code demo with the publicly available calls data for exploring the causal effect of retention calls on customer&#x2026;</p><p class="medium-feed-link"><a href="https://medium.com/@ds-faxi-yuan/use-case-of-causal-inference-for-price-elasticity-in-automobile-insurance-2b9a55a5391a?source=rss-104f31c5e11b------2">Continue reading on Medium »</a></p></div>]]></description>
            <link>https://medium.com/@ds-faxi-yuan/use-case-of-causal-inference-for-price-elasticity-in-automobile-insurance-2b9a55a5391a?source=rss-104f31c5e11b------2</link>
            <guid isPermaLink="false">https://medium.com/p/2b9a55a5391a</guid>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[causal-inference]]></category>
            <category><![CDATA[machine-learning]]></category>
            <dc:creator><![CDATA[Faxi Yuan, PhD]]></dc:creator>
            <pubDate>Sun, 19 Feb 2023 02:28:51 GMT</pubDate>
            <atom:updated>2023-11-19T17:19:23.119Z</atom:updated>
        </item>
        <item>
            <title><![CDATA[A guide to assign aggregated demographic information with a specific address]]></title>
            <link>https://medium.com/@ds-faxi-yuan/a-guide-to-assign-aggregated-demographic-information-with-a-specific-address-2df71b0618b1?source=rss-104f31c5e11b------2</link>
            <guid isPermaLink="false">https://medium.com/p/2df71b0618b1</guid>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[demographics]]></category>
            <category><![CDATA[geospatial-data-science]]></category>
            <dc:creator><![CDATA[Faxi Yuan, PhD]]></dc:creator>
            <pubDate>Sat, 07 Jan 2023 01:15:37 GMT</pubDate>
            <atom:updated>2023-02-09T01:10:38.528Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*p4PAG14O9i6tiar4.jpg" /><figcaption>Credit: <a href="https://givingcompass.org/article/why-demographic-data-is-important-for-funding-purposes">https://givingcompass.org/article/why-demographic-data-is-important-for-funding-purposes</a></figcaption></figure><p>Equity relevant issues such as access equity to critical infrastructures, facilities, groceries and medical centers, etc., are receiving increasing attention form both academia and other public institutions. According to these issues, research questions like which point of interest (POI)s such as a grocery and hospital mainly serve which group of people in terms of their demographic characters need to be resolved. With that, assigning aggregated (e.g., county-, city-, ZIP code-, census tract- and census block group-level) demographic information with a specific point of interest (POI) such as a grocery and hospital becomes necessary. Here, I am sharing with you a method I developed to assign a specific address with its corresponding aggregated demographic information, including 1) how to stream different demographic variables at different aggregation levels from US Census Database; 2) how to geocode an address and get its geo-coordinate; and 3) how to create a shapefile with geo-coordinates, check the coordinate reference systems (CRSs) of different shapefiles, and do the spatial join of different shapefiles.</p><p>Increasing studies in equity relevant issues such as equity of access to critical infrastructures and facilities, healthy food and environment, and medical centers, etc., have brought more attention to the aggregated demographic data. With such aggregated demographic data, researchers can investigate the distribution of critical facilities within a region such as a <strong>ZIP Code Tabulation Area</strong> (ZCTA), census tract (CT), and census block group (CBG), and further explore the impacts of their demographic information on such distributions.</p><p>More specifically, given a scenario, where addresses of a set of point of interests (POIs) like grocery stores are known and we want to know which group of people (in terms of their demographic characters) are mainly served by these grocery stores, what shall we do? The first step is to define which aggregation-level demographic data will be used such as ZCTA, CT, or CBG. Secondly, we need to stream the demographic data from census database with our defined aggregated levels. Thirdly, each grocery address will be assigned with a region ID (i.e., GEOIDs as defined by the US Census Data) such as ZIP code, CT GEOID or CBG GEOID. The last step is to join grocery store data with their aggregated demographic data through their region GEOIDs, and perform the analysis.</p><p>This tutorial will guide you to assign the aggregated demographic data with a specific address through the following steps. This tutorial mainly serves for researchers who are interested in using US census data from U.S. Census Bureau.</p><p><strong>Step 1. Defining aggregated level</strong></p><p>U.S. Census Bureau provides aggregated demographic data across country, state, county, city, ZCTA, CT, and CBG. Each level has its own GEOIDs. This tutorial takes a fine spatial resolution level, CBG, as an example. More details about GEOIDs for different levels can be referred from <a href="https://www.census.gov/programs-surveys/geography/guidance/geo-identifiers.html">U.S. Census Bureau</a>.</p><p><strong>Step 2. Streaming aggregated-level demographic data from US Census Bureau Database</strong></p><p>2.1 Basic introduction of US Census Bureau database:</p><p>1) This <a href="https://api.census.gov/data/2021/acs/acs5/variables.html">table </a>explains the demographic variables including their names and labels. Figure 1 shows a screenshot of the table head. Red frame highlights the variable name ‘B01001_002E’ and its label as ‘total male’. With this table, users can select to stream the demographic variables per their interests.</p><figure><img alt="Figure 1. Screenshot of variable dictionary" src="https://cdn-images-1.medium.com/max/1024/1*Pgm56AlzSFOL1d2AUyN88w.png" /><figcaption>Figure 1. Screenshot of variable dictionary</figcaption></figure><p>2) Census data API: This <a href="https://api.census.gov/data/2020/acs/acs5/examples.html">table </a>illustrates the request link structure of different aggregation levels including the input of GEOIDs of state, county, census tract and census block group, and variable names per users’ interests. Figure 2 presents the example request URLs at different aggregation levels. Red frame highlights the URL examples of CBG level, which includes the input of GEOIDs of state, county, tract, and block group, as well as the variable names.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*RaIm09EWQAxXmjXiXYA-AA.png" /><figcaption>Figure 2. Example request URLs provided by US census database</figcaption></figure><p>More details of URL structure components of CBG level were illustrated in Figure 3.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_OfwCWbxjAn_R3kMn3Xacw.png" /><figcaption>Figure 3. Explanations of CBG URL structure</figcaption></figure><p>Here, users need to apply and get their own API keys from the US census website.</p><p>2.2 Use case of streaming demographic data</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*C6_jdpXhlvTroVdU-XKbWw.png" /><figcaption>Figure 4. Loading Python libraries and CBGs of Boston</figcaption></figure><p>With CBGs of Boston, this tutorial takes ten of them for demonstration. The US Census Bureau provides the CBG GEOIDs in terms of various data formats like <a href="https://www.census.gov/geographies/mapping-files/time-series/geo/tiger-line-file.html">shapefiles</a>. Figure 5 defined the URL structure for these ten CBGs of Boston with the variable ‘B01001_002E’ (total male). ‘census_api_key’ refers to your personal API key which you can request from US Census Database.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*tRvLqDGDTKLoPyozLrGuGQ.png" /><figcaption>Figure 5. Request URL structure at CBG level</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*C6p-csXBHFcsQMUqRwEzLA.png" /><figcaption>Figure 6. Streaming variable information with user defined URL structure</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2AfA_tbHxvaqb0Bq708f_w.png" /><figcaption>Figure 7. Results check of variable ‘B01001_002E’</figcaption></figure><p><strong>Step 3. Assign an address with a GEOID</strong></p><p>3.1 Geocode addresses into coordinates</p><p>To assign an address with a CBG GEOID, we will start with geocoding such address. There are many APIs for geocoding addresses such as ESRI, Google, Microsoft, etc., where you can start with free trials with certain count of free geocoding addresses requests and later make subscriptions for further use. Here, I take GeoPy, a free Python package, to do the geocoding of addresses, though its efficiency may not be good compared with those paid API services. Figure 8 shows how GeoPy was used to geocode five randomly selected addresses of hospitals and groceries in Massachusetts.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*g-NfdRt8yfz9qh-oVyNEgg.png" /><figcaption>Figure 8. GeoPy for geocoding addresses</figcaption></figure><p>3.2 Creating a shapefile with geocoded coordinates</p><p>With the geocoded addresses, I will show you how we can create a point shapefile for further spatial join with the CBG shapefile. Figure 9 shows the reading of the geocoded addresses and their coordinates.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*bWX8c2POT98c009BrmnzwQ.png" /><figcaption>Figure 9. Reading geocoded sample addresses</figcaption></figure><p>Figure 10 starts with presenting how I defined the schema to create the point shapefile, then creating a fiona object where I specified the shapefile name as ‘geocodedAddressPoints.shp’, driver, and CRS, and finally writing out each geocoded addresses as a point within the point shapefile.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*WZEMUyDCFAhOocWbSXU5MA.png" /><figcaption>Figure 10. Creating point shapefile with geocoded addresses</figcaption></figure><p>3.3 Spatial joining geocoded addresses with CBG shapefiles</p><p>This section joins the point shapefile of geocoded addresses and the shapefile (polygon) of Masschusstes at CBG level, and finally assigns the CBG GEOID with each specific address.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/874/1*DUoh3ayuZctYlopYBp7EOg.png" /><figcaption>Figure 11. Reading shapefiles of geocoded addresses and Mass</figcaption></figure><p>Figure 12 shows the maps of Mass at CBG level and sample geocoded addresses.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*F5K3aT6qLm13w4_MCqxpxQ.png" /><figcaption>Figure 12. Drawing maps of Mass at CBG level and geocoded sample addresses</figcaption></figure><p>Figure 13 illustrates how to check the Coordinate Reference Systems (CRSs) of both shapefiles before joining them. More details of CRSs can be referred from <a href="https://datacarpentry.org/organization-geospatial/03-crs/">here</a>. When two shapefiles have different CRSs, here I converted the CRS of the geocoded address shapefile into the CRS of the Mass shapefile. With that, I draw them into one map. Red nodes denote the locations of my geocoded address samples.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1OC-78OCE9camJCuVpkU6A.png" /><figcaption>Figure 13. Checking CRSs of both shapefiles and making them consistent</figcaption></figure><p>From Figure 13, we can see their CRSs are consistent so that spatial join of them can be performed. Figure 14 shows how I did the spatial join. As a result, you can see each sample address has a CBG’s GEOID.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*VlhUoEFk_W6sWOiFgjCOQA.png" /><figcaption>Figure 14. Spatial join of geocoded address sample with Mass shapefile</figcaption></figure><p><strong>Final Step. Join address sample with demographic data</strong></p><p>For better visualization in Figure 15, I selected the GEOIDs relevant information from the ‘address_cbg’ data frame in Figure 14. Following that, I read the ‘B01001_002E’ variable table saved from Step 2 (Figure 7). Lastly, I joined sample addresses table with the CBG-level demographic data through their CBGs’ GEOIDs. ‘NaN’ denotes the situation where varibale ‘B01001_002E’ for that CBG is not avilable.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rmD6GYd293rZwqW9slGhsQ.png" /><figcaption>Figure 15. Final join of sample address with CBG-level demographic data</figcaption></figure><p><strong>Summary</strong></p><p>This tutorial shows you a process flow of how to assign the aggregated demographic information with a specific address. There are other methods to achieve this. Here I provided you one of them. Any comments and suggestions on this and other methods are warmly welcome!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2df71b0618b1" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>