Charities: Wedscraping a non-profit Organization

Posted on May 13, 2019

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

GitHub Project // Shiny App // Kaggle Dataset //


For this project, I chose to webscrape, 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. 


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.


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.


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.



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

About Author

Katy Qian

I have an B.S. in Electrical Engineering & an M.S. in Information Systems Management, with 9 years in telecom working mostly as a RF Engineer designing cell phone towers, but eager to transition my Data Science career into...
View all posts by Katy Qian >

Leave a Comment

No comments found.

View Posts by Categories

Our Recent Popular Posts

View Posts by Tags

#python #trainwithnycdsa 2019 2020 Revenue 3-points agriculture air quality airbnb airline alcohol Alex Baransky algorithm alumni Alumni Interview Alumni Reviews Alumni Spotlight alumni story Alumnus ames dataset ames housing dataset apartment rent API Application artist aws bank loans beautiful soup Best Bootcamp Best Data Science 2019 Best Data Science Bootcamp Best Data Science Bootcamp 2020 Best Ranked Big Data Book Launch Book-Signing bootcamp Bootcamp Alumni Bootcamp Prep boston safety Bundles cake recipe California Cancer Research capstone car price Career Career Day citibike classic cars classpass clustering Coding Course Demo Course Report covid 19 credit credit card crime frequency crops D3.js data data analysis Data Analyst data analytics data for tripadvisor reviews data science Data Science Academy Data Science Bootcamp Data science jobs Data Science Reviews Data Scientist Data Scientist Jobs data visualization database Deep Learning Demo Day Discount disney dplyr drug data e-commerce economy employee employee burnout employer networking environment feature engineering Finance Financial Data Science fitness studio Flask flight delay gbm Get Hired ggplot2 googleVis H20 Hadoop hallmark holiday movie happiness healthcare frauds higgs boson Hiring hiring partner events Hiring Partners hotels housing housing data housing predictions housing price hy-vee Income Industry Experts Injuries Instructor Blog Instructor Interview insurance italki Job Job Placement Jobs Jon Krohn JP Morgan Chase Kaggle Kickstarter las vegas airport lasso regression Lead Data Scienctist Lead Data Scientist leaflet league linear regression Logistic Regression machine learning Maps market matplotlib Medical Research Meet the team meetup methal health miami beach movie music Napoli NBA netflix Networking neural network Neural networks New Courses NHL nlp NYC NYC Data Science nyc data science academy NYC Open Data nyc property NYCDSA NYCDSA Alumni Online Online Bootcamp Online Training Open Data painter pandas Part-time performance phoenix pollutants Portfolio Development precision measurement prediction Prework Programming public safety PwC python Python Data Analysis python machine learning python scrapy python web scraping python webscraping Python Workshop R R Data Analysis R language R Programming R Shiny r studio R Visualization R Workshop R-bloggers random forest Ranking recommendation recommendation system regression Remote remote data science bootcamp Scrapy scrapy visualization seaborn seafood type Selenium sentiment analysis sentiment classification Shiny Shiny Dashboard Spark Special Special Summer Sports statistics streaming Student Interview Student Showcase SVM Switchup Tableau teachers team team performance TensorFlow Testimonial tf-idf Top Data Science Bootcamp Top manufacturing companies Transfers tweets twitter videos visualization wallstreet wallstreetbets web scraping Weekend Course What to expect whiskey whiskeyadvocate wildfire word cloud word2vec XGBoost yelp youtube trending ZORI