Day44: Querying PostgreSQL

Posted by csiu on April 9, 2017 | with: 100daysofcode,

In this post, I asked 3 questions:

  • 1) What kind of projects are popular on Kickstarter?
  • 2) How much money are people asking for?
  • 3) What kind of projects tend to be funded?

The Jupyter Notebook for this little project is found here.

Prerequisites

Before we answer the questions, I do 3 things:

[1] Connect to the database with psycopg2

[2] Check the identity (and data type of the) columns in the table

SELECT column_name, data_type FROM information_schema.columns WHERE table_name = 'info';

[3] Count the number of records in the database table (there are 177,140)

SELECT COUNT(*) from info;

Question 1: Project topics

In the first question, we want to know how many different types of projects are listed on Kickstarter. We are also interested in learning the type of projects most and least people start on Kickstarter.

SELECT topic, COUNT(*) from info GROUP BY topic ORDER BY count DESC

Analyzing the data, we find there are 143 different types of Kickstarter projects. The most popular type is “Web” (n=4476) and the rarest type is “Taxidermy” (n=12).

Question 2: Project funding goals

In the second question, we were interested in how much people were asking for.

SELECT id, topic, goal*static_usd_rate as goal_usd FROM info

In general, projects were asking between $316 - $100,000 USD.

When we divide the projects by topics, we find “Movie Theaters” and “Space Exploration” had the average highest funding goals.

Space travel is expensive.

Question 3: Funding success

Finally, we want to know what tends to be funded.

SELECT id, topic, goal, pledged, pledged/goal as progress FROM info ORDER BY progress DESC

From the look at the bottom figure (showing the number of projects that were successfully funded), we find “Short”, “Documentary”, and “Tabletop games” to be the most successful in meeting the project funding goals.