Charities: Wedscraping a non-profit Organization
Project GitHub | LinkedIn: Niki Moritz Hao-Wei Matthew Oren
The skills we demoed here can be learned through taking Data Science with Machine Learning bootcamp with NYC Data Science Academy.
A look into ratings & expenses of 8400+ charities as scrapped from CharityNavigator.org
GitHub Project // Shiny App // Kaggle Dataset // CharityNavigator.org
INTRO:
For this project, I chose to webscrape CharityNavigator.org, a non-profit organization who's mission is to provide a non-biased rating for other non-profits. Their scoring system is based on both financial & accountability metrics, and also collect information on leadership compensation. They do have an API set up, but the access with full details would require a subscription fee.
WEBSCRAPPING:
I used Python/Scrapy for the webscraping portion. They have 9158 charities rated on their website, split into 0-Z pages. It took 6h 30m (!) to webscrape 7MB of data. I collected 21 columns of data for 8655 charities, focusing mostly on the quantitative stats. I was unable to get information for 503 charities since any charity that was under federal investigation had their rating temporarily removed. One lesson learned is that I should have coded in a logger to track progress, as the program did not work through in ABC order as expected and while it ran, it was difficult to know how much longer it would take.
DATA CLEANING:
I used Python/Pandas for the data cleaning. Several STATES were incorrectly scrapped, as most were in "Name - NJ" format but some had "-" as part of their name. Those records were removed. Several TOTAL EXPENSES were also incorrectly scrapped with ")", as some had very limited financial activity & formatted differently, so the xpath strategy used had collected the wrong information. These records were also removed. At the end, I had 8408 complete charity information (or about 94.5%) and uploaded the clean dataset to Kaggle.
DATA VISUALIZATION:
I used R/ggplot2/Shiny for the data visualization, since its easily publishable & can display a variety of visuals easily. IThe State Map view shows the count of charities over USA States. Most charities are located in CA, NY, TX, DC & FL as expected,.. but it was also interesting to see the biggest (highest average total expenses) were located in CT, IL, GA, DC & VA, where IL/CT/DC were due to outliers of the top 3 spending of all charities.
The Size vs. Spending view shows spending type by size, where smaller charities seem to focus more on funding & administrative expenses as they focus on growth. Big were 17%, Mid were 35% and Small were 48% of charities. The top 1% of charities were spending more than 31.6% of all expenses combined... and the top 5 ($1B+) were spending 8.5%. Big means big!
There's also a violin plot showing categories and expense density, where 'Human Services' has the highest average expenses and 'Religion' looks to have the lowest average expenses.

The Score Correlation view shows the relationship between Accountability Score & Financial Score. It seems easier to score higher on the Accountability scale, and majority of the big & mid sized charities are closer to the 100 mark.

The Leader List view is a simple data table that showcases which leaders are getting paid the most, both in dollar amount & in percentage of total expenses. Not all leaders are compensated, and not all leader's compensations are reported. Almost 20 leaders are being paid > $1M, and almost 15 leaders are being paid > 25% of the total expenses. These can be easily tagged as suspicious. The top 1% of leaders were taking home 6% of the total leader compensation.
FUTURE INSIGHTS:
If I had more time, I would like to crawl some other charity-rating sites (such as watchdog and BBC) and correlate their scoring metrics with Charity Navigator. I would have also liked to extract the score history information of several key charities, to see how their scores have changed over time. And finally, with the existing dataset, there is alot more drilling down that can be done by category or size level to see if any recommended actions could come out of it.
Thank you for reading! =)
If you would like to support Charity Navigator and their mission to provide un-biased ratings of charities, feel free to donate here.
-------------------------
Total Rated = 9158
Total Scrapped = 8655
Total Clean = 8408
Total Time = 6h 30m with Python/Scrapy