Data Science Portfolio Project: Where to Advertise an E-learning Product

At Dataquest, we strongly advocate portfolio projects as a means of getting a first data science job. In this blog post, we’ll walk you through an example portfolio project.

The project is part of our Statistics Intermediate: Averages and Variability course, and it assumes familiarity with:

  • Sampling (populations, samples, sample representativity)
  • Frequency distributions
  • Box plots and bar plots
  • Summary metrics (especially the mean)
  • pandas, matplotlib, and seaborn

If you think you need to fill in any gaps before moving forward, we cover the topics above in depth in our Statistics Fundamentals and Statistics Intermediate: Averages and Variability courses. This course will also give you deeper instructions on how to build this project, and code it in your browser.

We also teach pandas, matplotlib, and seaborn in our Data Scientist Path.

This project follows the guidelines presented in our style guide for data science projects.

Introduction

In this project, we’ll aim to find the two best markets to advertise our product in — we’re working for an e-learning company that offers courses on programming. Most of our courses are on web and mobile development, but we also cover other domains, like data science, game development, etc.

We’ll analyze existing data about new coders to find the best markets to invest in for advertisting. To make our recommendation, we’ll try to find out:

  • Where are these new coders located.
  • Which locations have the greatest number of new coders.
  • How much money new coders are willing to spend on learning.

Summary of results

After analyzing the data, the only solid conclusion we reached is that the US would be a good market to advertise in. For the second best market, it wasn’t clear-cut what to choose between India and Canada. We decided to send the results to the marketing team so they can use their domain knowledge to take the best decision.

For more details, please refer to the the full analysis below.

Exploring existing data

To avoid spending money on organizing a survey, we’ll first try to make use of existing data to determine whether we can reach a reliable result.

One good candidate for our purpose is freeCodeCamp’s 2017 New Coder Survey. freeCodeCamp is a free e-learning platform that offers courses on web development. Because they run a popular Medium publication (over 400,000 followers), their survey attracted new coders with varying interests (not only web development), which is ideal for our analysis.

The survey data is publicly available in this GitHub repository. Below, we’ll do a quick exploration of the 2017-fCC-New-Coders-Survey-Data.csv file stored in the clean-data folder of the repository we just mentioned. We’ll read in the file using the direct link here.

# Read in the dataimport pandas as pd
direct_link = 'https://raw.githubusercontent.com/freeCodeCamp/2017-new-coder-survey/master/clean-data/2017-fCC-New-Coders-Survey-Data.csv'
fcc = pd.read_csv(direct_link, low_memory = 0) 
# low_memory = False to silence dtypes warning
# Quick exploration of the data
print(fcc.shape)
pd.options.display.max_columns = 150 # to avoid truncated output fcc.head()
(18175, 136)
AgeAttendedBootcampBootcampFinishBootcampLoanYesNoBootcampNameBootcampRecommendChildrenNumberCityPopulationCodeEventConferencesCodeEventDjangoGirlsCodeEventFCCCodeEventGameJamCodeEventGirlDevCodeEventHackathonsCodeEventMeetupCodeEventNodeSchoolCodeEventNoneCodeEventOtherCodeEventRailsBridgeCodeEventRailsGirlsCodeEventStartUpWkndCodeEventWkdBootcampsCodeEventWomenCodeCodeEventWorkshopsCommuteTimeCountryCitizenCountryLiveEmploymentFieldEmploymentFieldOtherEmploymentStatusEmploymentStatusOtherExpectedEarningFinanciallySupportingFirstDevJobGenderGenderOtherHasChildrenHasDebtHasFinancialDependentsHasHighSpdInternetHasHomeMortgageHasServedInMilitaryHasStudentDebtHomeMortgageOweHoursLearningID.xID.yIncomeIsEthnicMinorityIsReceiveDisabilitiesBenefitsIsSoftwareDevIsUnderEmployedJobApplyWhenJobInterestBackEndJobInterestDataEngrJobInterestDataSciJobInterestDevOpsJobInterestFrontEndJobInterestFullStackJobInterestGameDevJobInterestInfoSecJobInterestMobileJobInterestOtherJobInterestProjMngrJobInterestQAEngrJobInterestUXJobPrefJobRelocateYesNoJobRoleInterestJobWherePrefLanguageAtHomeMaritalStatusMoneyForLearningMonthsProgrammingNetworkIDPart1EndTimePart1StartTimePart2EndTimePart2StartTimePodcastChangeLogPodcastCodeNewbiePodcastCodePenPodcastDevTeaPodcastDotNETPodcastGiantRobotsPodcastJSAirPodcastJSJabberPodcastNonePodcastOtherPodcastProgThrowdownPodcastRubyRoguesPodcastSEDailyPodcastSERadioPodcastShopTalkPodcastTalkPythonPodcastTheWebAheadResourceCodecademyResourceCodeWarsResourceCourseraResourceCSSResourceEdXResourceEggheadResourceFCCResourceHackerRankResourceKAResourceLyndaResourceMDNResourceOdinProjResourceOtherResourcePluralSightResourceSkillcrushResourceSOResourceTreehouseResourceUdacityResourceUdemyResourceW3SSchoolDegreeSchoolMajorStudentDebtOweYouTubeCodeCourseYouTubeCodingTrainYouTubeCodingTut360YouTubeComputerphileYouTubeDerekBanasYouTubeDevTipsYouTubeEngineeredTruthYouTubeFCCYouTubeFunFunFunctionYouTubeGoogleDevYouTubeLearnCodeYouTubeLevelUpTutsYouTubeMITYouTubeMozillaHacksYouTubeOtherYouTubeSimplilearnYouTubeTheNewBoston
027.00.0NaNNaNNaNNaNNaNmore than 1 millionNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaN15 to 29 minutesCanadaCanadasoftware development and ITNaNEmployed for wagesNaNNaNNaNNaNfemaleNaNNaN1.00.01.00.00.00.0NaN15.002d9465b21e8bd09374b0066fb2d5614eb78c1c3ac6cd9052aec557065070fbfNaNNaN0.00.00.0NaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNstart your own businessNaNNaNNaNEnglishmarried or domestic partnership150.06.06f1fbc6b2b2017-03-09 00:36:222017-03-09 00:32:592017-03-09 00:59:462017-03-09 00:36:26NaNNaNNaN1.0NaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaN1.0NaNNaNNaNNaNNaN1.0NaNNaNNaN1.0NaNNaNNaNNaNNaNNaNNaN1.01.0some college credit, no degreeNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaN
134.00.0NaNNaNNaNNaNNaNless than 100,000NaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNUnited States of AmericaUnited States of AmericaNaNNaNNot working but looking for workNaN35000.0NaNNaNmaleNaNNaN1.00.01.00.00.01.0NaN10.05bfef9ecb211ec4f518cfc1d2a6f3e0c21db37adb60cdcafadfa7dca1b13b6b1NaN0.00.00.0NaNWithin 7 to 12 monthsNaNNaNNaNNaNNaN1.0NaNNaNNaNNaNNaNNaNNaNwork for a nonprofit1.0Full-Stack Web Developerin an office with other developersEnglishsingle, never married80.06.0f8f8be69102017-03-09 00:37:072017-03-09 00:33:262017-03-09 00:38:592017-03-09 00:37:10NaN1.0NaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaN1.0NaNNaN1.0NaNNaN1.0NaNNaNNaNNaNNaNNaNNaNNaN1.0NaNNaN1.01.0some college credit, no degreeNaNNaNNaNNaNNaNNaNNaNNaNNaN1.0NaNNaNNaNNaNNaNNaNNaNNaNNaN
221.00.0NaNNaNNaNNaNNaNmore than 1 millionNaNNaNNaNNaNNaN1.0NaN1.0NaNNaNNaNNaNNaNNaNNaNNaN15 to 29 minutesUnited States of AmericaUnited States of Americasoftware development and ITNaNEmployed for wagesNaN70000.0NaNNaNmaleNaNNaN0.00.01.0NaN0.0NaNNaN25.014f1863afa9c7de488050b82eb3edd9621ba173828fbe9e27ccebaf4d5166a5513000.01.00.00.00.0Within 7 to 12 months1.0NaNNaN1.01.01.0NaNNaN1.0NaNNaNNaNNaNwork for a medium-sized company1.0Front-End Web Developer, Back-End Web Develo…no preferenceSpanishsingle, never married1000.05.02ed189768e2017-03-09 00:37:582017-03-09 00:33:532017-03-09 00:40:142017-03-09 00:38:021.0NaN1.0NaNNaNNaNNaNNaNNaNCodenewbieNaNNaNNaNNaN1.0NaNNaN1.0NaNNaN1.0NaNNaN1.0NaNNaNNaN1.0NaNNaNNaNNaNNaNNaN1.01.0NaNhigh school diploma or equivalent (GED)NaNNaNNaNNaN1.0NaN1.01.0NaNNaNNaNNaN1.01.0NaNNaNNaNNaNNaN
326.00.0NaNNaNNaNNaNNaNbetween 100,000 and 1 millionNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNI work from homeBrazilBrazilsoftware development and ITNaNEmployed for wagesNaN40000.00.0NaNmaleNaN0.01.01.01.01.00.00.040000.014.091756eb4dc280062a541c25a3d44cfb03be37b558f02daae93a6da10f83f0c7724000.00.00.00.01.0Within the next 6 months1.0NaNNaNNaN1.01.0NaNNaNNaNNaNNaNNaNNaNwork for a medium-sized companyNaNFront-End Web Developer, Full-Stack Web Deve…from homePortuguesemarried or domestic partnership0.05.0dbdc0664d12017-03-09 00:40:132017-03-09 00:37:452017-03-09 00:42:262017-03-09 00:40:18NaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaN1.01.0NaNNaNNaN1.0NaNNaNNaNNaN1.0NaNNaNNaNNaNsome college credit, no degreeNaNNaNNaNNaNNaNNaNNaN1.0NaN1.01.0NaNNaN1.0NaNNaNNaNNaNNaN
420.00.0NaNNaNNaNNaNNaNbetween 100,000 and 1 millionNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNPortugalPortugalNaNNaNNot working but looking for workNaN140000.0NaNNaNfemaleNaNNaN0.00.01.0NaN0.0NaNNaN10.0aa3f061a1949a90b27bef7411ecd193fd7c56bbf2c7b62096be9db010e86d96dNaN0.00.00.0NaNWithin 7 to 12 months1.0NaNNaNNaN1.01.0NaN1.01.0NaNNaNNaNNaNwork for a multinational corporation1.0Full-Stack Web Developer, Information Security…in an office with other developersPortuguesesingle, never married0.024.011b0f2d8a92017-03-09 00:42:452017-03-09 00:39:442017-03-09 00:45:422017-03-09 00:42:50NaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaN1.0NaNNaNNaNNaNbachelor’s degreeInformation TechnologyNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaN

Checking for sample representativity

As we mentioned in the introduction, most of our courses are on web and mobile development, but we also cover many other domains, like data science and game development. For the purpose of our analysis, we want to answer questions about a population of new coders that are interested in the subjects we teach. As a reminder, we’d like to know:

  • Where are these new coders located.
  • Which locations have the most new coders.
  • How much money they’re willing to spend on learning.

We first need to clarify whether the data set has the categories that we need. The JobRoleInterest column describes the role(s) each participant is interested in working in. If a participant is interested in working in a certain domain, we can assume that they’re also interested in learning about that domain. So let’s take a look at the frequency distribution table of this column and determine whether the data we have is relevant.


# Frequency distribution table for 'JobRoleInterest
'fcc['JobRoleInterest'].value_counts(normalize = True) * 100

Full-Stack Web Developer                                                                                                                                                                                                                                     11.770595
  Front-End Web Developer                                                                                                                                                                                                                                     6.435927
  Data Scientist                                                                                                                                                                                                                                              2.173913
Back-End Web Developer                                                                                                                                                                                                                                        2.030892
  Mobile Developer                                                                                                                                                                                                                                            1.673341
Game Developer                                                                                                                                                                                                                                                1.630435
Information Security                                                                                                                                                                                                                                          1.315789
Full-Stack Web Developer,   Front-End Web Developer                                                                                                                                                                                                           0.915332
  Front-End Web Developer, Full-Stack Web Developer                                                                                                                                                                                                           0.800915
  Product Manager                                                                                                                                                                                                                                             0.786613
Data Engineer                                                                                                                                                                                                                                                 0.758009
  User Experience Designer                                                                                                                                                                                                                                    0.743707
  User Experience Designer,   Front-End Web Developer                                                                                                                                                                                                         0.614989
  Front-End Web Developer, Back-End Web Developer, Full-Stack Web Developer                                                                                                                                                                                   0.557780
Back-End Web Developer, Full-Stack Web Developer,   Front-End Web Developer                                                                                                                                                                                   0.514874
Back-End Web Developer,   Front-End Web Developer, Full-Stack Web Developer                                                                                                                                                                                   0.514874
  DevOps / SysAdmin                                                                                                                                                                                                                                           0.514874
Full-Stack Web Developer,   Front-End Web Developer, Back-End Web Developer                                                                                                                                                                                   0.443364
  Front-End Web Developer, Full-Stack Web Developer, Back-End Web Developer                                                                                                                                                                                   0.429062
  Front-End Web Developer,   User Experience Designer                                                                                                                                                                                                         0.414760
Full-Stack Web Developer,   Mobile Developer                                                                                                                                                                                                                  0.414760
Back-End Web Developer, Full-Stack Web Developer                                                                                                                                                                                                              0.386156
Full-Stack Web Developer, Back-End Web Developer                                                                                                                                                                                                              0.371854
Back-End Web Developer,   Front-End Web Developer                                                                                                                                                                                                             0.286041
Full-Stack Web Developer, Back-End Web Developer,   Front-End Web Developer                                                                                                                                                                                   0.271739
Data Engineer,   Data Scientist                                                                                                                                                                                                                               0.271739
  Front-End Web Developer,   Mobile Developer                                                                                                                                                                                                                 0.257437
Full-Stack Web Developer,   Data Scientist                                                                                                                                                                                                                    0.243135
  Mobile Developer, Game Developer                                                                                                                                                                                                                            0.228833
  Data Scientist, Data Engineer                                                                                                                                                                                                                               0.228833
                                                                                                                                                                                                                                                               ...    
  Mobile Developer,   User Experience Designer, Full-Stack Web Developer,   DevOps / SysAdmin, Technical Writer                                                                                                                                               0.014302
Data Engineer,   Data Scientist, Information Security                                                                                                                                                                                                         0.014302
  Mobile Developer, Full-Stack Web Developer,   Product Manager, Game Developer, Information Security,   Front-End Web Developer,   User Experience Designer,   Data Scientist                                                                                0.014302
Back-End Web Developer, Game Developer, Data Engineer                                                                                                                                                                                                         0.014302
Full-Stack Web Developer, Information Security, Back-End Web Developer, Data Engineer,   Mobile Developer,   Data Scientist,   DevOps / SysAdmin                                                                                                              0.014302
Software Specialist                                                                                                                                                                                                                                           0.014302
Game Developer, Information Security,   Mobile Developer,   DevOps / SysAdmin, Full-Stack Web Developer,   Front-End Web Developer                                                                                                                            0.014302
Back-End Web Developer, Game Developer, Full-Stack Web Developer,   Front-End Web Developer,   DevOps / SysAdmin                                                                                                                                              0.014302
  Front-End Web Developer, Back-End Web Developer, Full-Stack Web Developer, Game Developer,   Mobile Developer                                                                                                                                               0.014302
Game Developer, Information Security, Full-Stack Web Developer, Back-End Web Developer                                                                                                                                                                        0.014302
  Front-End Web Developer,   Data Scientist, Game Developer,   Product Manager, Information Security                                                                                                                                                          0.014302
  Front-End Web Developer,   Mobile Developer, Information Security, Full-Stack Web Developer,   DevOps / SysAdmin, Back-End Web Developer, Game Developer                                                                                                    0.014302
  Mobile Developer, Game Developer, Full-Stack Web Developer, Back-End Web Developer,   Front-End Web Developer                                                                                                                                               0.014302
Data Engineer,   Front-End Web Developer,   Data Scientist, Full-Stack Web Developer                                                                                                                                                                          0.014302
  Product Manager, Back-End Web Developer,   Data Scientist, Full-Stack Web Developer, Game Developer,   User Experience Designer, Information Security                                                                                                       0.014302
  Mobile Developer, Back-End Web Developer,   Front-End Web Developer, Full-Stack Web Developer                                                                                                                                                               0.014302
  User Experience Designer, Full-Stack Web Developer,   Front-End Web Developer,   Mobile Developer, User Interface Design                                                                                                                                    0.014302
Full-Stack Web Developer,   Quality Assurance Engineer, Game Developer,   Front-End Web Developer,   User Experience Designer                                                                                                                                 0.014302
  Quality Assurance Engineer,   Front-End Web Developer,   User Experience Designer, Game Developer                                                                                                                                                           0.014302
  DevOps / SysAdmin,   Data Scientist, Full-Stack Web Developer, Information Security, Data Engineer, Back-End Web Developer                                                                                                                                  0.014302
Full-Stack Web Developer,   Data Scientist,   User Experience Designer,   Mobile Developer,   Front-End Web Developer                                                                                                                                         0.014302
Data Engineer,   Product Manager,   Data Scientist                                                                                                                                                                                                            0.014302
Full-Stack Web Developer,   User Experience Designer, Back-End Web Developer,   Data Scientist, Information Security, Criminal Defense Attorney-- focusing on cyber crimes                                                                                    0.014302
Data Engineer,   User Experience Designer,   Front-End Web Developer, Game Developer,   Data Scientist,   Product Manager                                                                                                                                     0.014302
  Front-End Web Developer,   User Experience Designer,   DevOps / SysAdmin, Back-End Web Developer,   Data Scientist, Game Developer,   Product Manager,   Quality Assurance Engineer, Full-Stack Web Developer, Information Security,   Mobile Developer     0.014302
Education                                                                                                                                                                                                                                                     0.014302
  DevOps / SysAdmin,   Mobile Developer, Full-Stack Web Developer,   Front-End Web Developer                                                                                                                                                                  0.014302
Back-End Web Developer,   Data Scientist, Information Security,   Front-End Web Developer,   Quality Assurance Engineer,   DevOps / SysAdmin, Data Engineer, Game Developer, Full-Stack Web Developer                                                         0.014302
  Data Scientist, Back-End Web Developer, Full-Stack Web Developer,   Front-End Web Developer,   User Experience Designer,   Mobile Developer                                                                                                                 0.014302
Game Developer,   Mobile Developer, Back-End Web Developer,   Front-End Web Developer, Information Security                                                                                                                                                   0.014302

The information in the table above is quite granular, but from a quick scan it looks like:

  • A lot of people are interested in web development (full-stack web development, front-end web development and back-end web development).
  • A few people (1.7%) are interested in mobile development.
  • Not too many people are interested in domains other than web and mobile development.

It’s also interesting to note that many respondents are interested in more than one subject. It’d be useful to get a better picture of how many people are interested in a single subject and how many have mixed interests. Consequently, in the next code block, we’ll:

  • Split each string in the JobRoleInterest column to find the number of options for each participant.
    • We’ll first drop the null values because we can’t split Nan values.
  • Generate a frequency table for the variable describing the number of options.
# Split each string in the 'JobRoleInterest' column
interests_no_nulls = fcc['JobRoleInterest'].dropna()
splitted_interests = interests_no_nulls.str.split(',')
# Frequency table for the var describing the number of options
n_of_options = splitted_interests.apply(lambda x: len(x)) # x is a list of job options
n_of_options.value_counts(normalize = True).sort_index() * 100

1     31.650458
2     10.883867
3     15.889588
4     15.217391
5     12.042334
6      6.721968
7      3.861556
8      1.759153
9      0.986842
10     0.471968
11     0.185927
12     0.300343
13     0.028604
Name: JobRoleInterest, dtype: float64

Only 31.7% of the participants have a clear idea about what programming niche they’d like to work in, while the vast majority of students have mixed interests. Given that we offer courses on various subjects, the fact that new coders have mixed interest might be actually good for us.

The focus of our courses is on web and mobile development, so let’s find out how many respondents chose at least one of these two options.


# Frequency table
web_or_mobile = interests_no_nulls.str.contains(
    'Web Developer|Mobile Developer') # returns an array of booleans
freq_table = web_or_mobile.value_counts(normalize = True) * 100
print(freq_table)

# Graph for the frequency table above

import matplotlib.pyplot as plt
plt.style.use('fivethirtyeight')

freq_table.plot.bar()
plt.title('Most Participants are Interested in \nWeb or Mobile
           Development", y = 1.08) # y pads the title upward
plt.ylabel('Percentage', fontsize = 12)
plt.xticks([0,1],['Web or mobile\ndevelopment', 'Other subject'],
           rotation = 0) # the initial xtick labels were True and False
plt.ylim([0,100])
plt.show()

True     86.241419
False    13.758581
Name: JobRoleInterest, dtype: float64

Stats2_7_1

Most people in this survey (roughly 86%) are interested in either web or mobile development. These figures offer us a strong reason to consider this sample representative for our population of interest. We want to advertise our courses to people interested in all sorts of programming niches but mostly web and mobile development.

New coders — locations and densities

Let’s begin with finding out where these new coders are located, and the densities (how many new coders there are) for each location. This should be a good start for finding out the best two markets in which to run our ads campaign.

The data set provides information about the location of each participant at a country level. We can think of each country as an individual market, so we can frame our goal as finding the two best countries to advertise in.

We can start by examining the frequency distribution table of the CountryLive variable, which describes what country each participant lives in (not their origin country). We’ll only consider those participants who answered what role(s) they’re interested in, to make sure we work with a representative sample.


# Isolate the participants that answered what role they'd be interested in
fcc_good = fcc[fcc['JobRoleInterest'].notnull()].copy()

# Frequency tables with absolute and relative frequencies
absolute_frequencies = fcc_good['CountryLive'].value_counts()
relative_frequencies = fcc_good['CountryLive'].value_counts(normalize = True) * 100

# Display the frequency tables in a more readable format
pd.DataFrame(data = {'Absolute frequency': absolute_frequencies,
                      'Percentage': relative_frequencies}
            )
Absolute frequencyPercentage
United States of America312545.700497
India5287.721556
United Kingdom3154.606610
Canada2603.802281
Poland1311.915765
Brazil1291.886517
Germany1251.828020
Australia1121.637906
Russia1021.491664
Ukraine891.301550
Nigeria841.228429
Spain771.126060
France751.096812
Romania711.038315
Netherlands (Holland, Europe)650.950570
Italy620.906698
Serbia520.760456
Philippines520.760456
Greece460.672711
Ireland430.628839
South Africa390.570342
Mexico370.541094
Turkey360.526470
Hungary340.497221
Singapore340.497221
New Zealand330.482597
Argentina320.467973
Croatia320.467973
Sweden310.453349
Indonesia310.453349
Mozambique10.014624
Yemen10.014624
Cuba10.014624
Sudan10.014624
Guatemala10.014624
Bolivia10.014624
Jordan10.014624
Myanmar10.014624
Samoa10.014624
Gambia10.014624
Channel Islands10.014624
Vanuatu10.014624
Trinidad & Tobago10.014624
Papua New Guinea10.014624
Liberia10.014624
Panama10.014624
Rwanda10.014624
Cameroon10.014624
Aruba10.014624
Gibraltar10.014624
Anguilla10.014624
Botswana10.014624
Turkmenistan10.014624
Kyrgyzstan10.014624
Qatar10.014624
Angola10.014624
Nambia10.014624
Guadeloupe10.014624
Nicaragua10.014624
Cayman Islands10.014624

137 rows × 2 columns

45.7% of our potential customers are located in the US, and this definitely seems like the most interesting market. India has the second customer density, but it’s just 7.7%, which is not too far from the United Kingdom (4.6%) or Canada (3.8%).

This is useful information, but we need to go more in depth than this and figure out how much money people are actually willing to spend on learning. Advertising in high-density markets where most people are only willing to learn for free is extremely unlikely to be profitable for us.

Spending money for learning

The MoneyForLearning column describes in American dollars the amount of money spent by participants from the moment they started coding until the moment they completed the survey. Our company sells subscriptions at a price of $59 per month, and for this reason we’re interested in finding out how much money each student spends per month.

We’ll narrow down our analysis to only four countries: the US, India, the United Kingdom, and Canada. We do this for two reasons:

  • These are the countries having the highest frequency in the frequency table above, which means we have a decent amount of data for each.
  • Our courses are written in English, and English is an official language in all these four countries. The more people know English, the better our chances to target the right people with our ads.

Let’s start with creating a new column that describes the amount of money a student has spent per month so far. To do that, we’ll need to divide the MoneyForLearning column to the MonthsProgramming column. The problem is that some students answered that they have been learning to code for 0 months (it might be that they have just started). To avoid dividing by 0, we’ll replace 0 with 1 in the MonthsProgramming column.


# Replace 0s with 1s to avoid division by 0fcc_good['MonthsProgramming'].replace(0,1, inplace = True)

# New column for the amount of money each student spends each month
fcc_good['money_per_month'] = fcc_good['MoneyForLearning'] / fcc_good['MonthsProgramming']
fcc_good['money_per_month'].isnull().sum()
675

Let’s keep only the rows that don’t have null values for the money_per_month column.


# Keep only the rows with non-nulls in the `money_per_month` column 
fcc_good = fcc_good[fcc_good['money_per_month'].notnull()]

We want to group the data by country, and then measure the average amount of money that students spend per month in each country. First, let’s remove the rows having null values for the CountryLive column, and check out if we still have enough data for the four countries that interest us.


# Remove the rows with null values in 'CountryLive'
fcc_good = fcc_good[fcc_good['CountryLive'].notnull()]

# Frequency table to check if we still have enough data
fcc_good['CountryLive'].value_counts().head()

United States of America    2933
India                        463
United Kingdom               279
Canada                       240
Poland                       122
Name: CountryLive, dtype: int64

This should be enough, so let’s compute the average value spent per month in each country by a student. We’ll compute the average using the mean.


# Mean sum of money spent by students each month
countries_mean = fcc_good.groupby('CountryLive').mean()
countries_mean['money_per_month'][['United States of America',
                            'India', 'United Kingdom',
                            'Canada']]

CountryLive
United States of America    227.997996
India                       135.100982
United Kingdom               45.534443
Canada                      113.510961
Name: money_per_month, dtype: float64

The results for the United Kingdom and Canada are a bit surprising relative to the values we see for India. If we considered a few socio-economical metrics (like GDP per capita), we’d intuitively expect people in the UK and Canada to spend more on learning than people in India.

It might be that we don’t have have enough representative data for the United Kingdom and Canada, or we have some outliers (maybe coming from wrong survey answers) making the mean too large for India, or too low for the UK and Canada. Or it might be that the results are correct.

Dealing with extreme outliers

Let’s use box plots to visualize the distribution of the money_per_month variable for each country.


# Isolate only the countries of interest
only_4 = fcc_good[fcc_good['CountryLive'].str.contains(
    'United States of America|India|United Kingdom|Canada')]

# Box plots to visualize distributions
import seaborn as sns
sns.boxplot(y = 'money_per_month', x = 'CountryLive',
            data = only_4)
plt.title('Money Spent Per Month Per Country\n(Distributions)',         fontsize = 16)
plt.ylabel('Money per month (US dollars)')
plt.xlabel('Country')
plt.xticks(range(4), ['US', 'UK', 'India', 'Canada']) # avoids tick labels overlap
plt.show()

Stats2_19_0

It’s hard to see on the plot above if there’s anything wrong with the data for the United Kingdom, India, or Canada, but we can see immediately that there’s something really off for the US: it says two persons spend \$50,000 or more each month for learning. This is not impossible, but it seems extremely unlikely, so we’ll remove every value that goes over \$20,000 per month.


# Isolate only those participants who spend less than 10000 per month
fcc_good = fcc_good[fcc_good['money_per_month'] < 20000]

Now let’s recompute the mean values and plot the box plots again.


# Recompute mean sum of money spent by students each month
countries_mean = fcc_good.groupby('CountryLive').mean()
countries_mean['money_per_month'][['United States of America',
                            'India', 'United Kingdom',
                            'Canada']]
CountryLive
United States of America    183.800110
India                       135.100982
United Kingdom               45.534443
Canada                      113.510961
Name: money_per_month, dtype: float64

# Isolate again the countries of interest
only_4 = fcc_good[fcc_good['CountryLive'].str.contains(
    'United States of America|India|United Kingdom|Canada')]
# Box plots to visualize distributions
sns.boxplot(y = 'money_per_month', x = 'CountryLive',
            data = only_4)
plt.title('Money Spent Per Month Per Country\n(Distributions)',
         fontsize = 16)
plt.ylabel('Money per month (US dollars)')
plt.xlabel('Country')
plt.xticks(range(4), ['US', 'UK', 'India', 'Canada']) 
# avoids tick labels overlapplt.show()

Stats2_24_0

We can see a few extreme outliers for India (values over $2,500 per month), but it’s unclear whether this is good data or not. Maybe these persons attended several bootcamps, which tend to be very expensive. Let’s examine these two data points to see if we can find anything relevant.


# Inspect the extreme outliers for India
india_outliers = only_4[
     (only_4['CountryLive'] == 'India') &
     (only_4['money_per_month'] >= 2500)]
india_outliers
AgeAttendedBootcampBootcampFinishBootcampLoanYesNoBootcampNameBootcampRecommendChildrenNumberCityPopulationCodeEventConferencesCodeEventDjangoGirlsCodeEventFCCCodeEventGameJamCodeEventGirlDevCodeEventHackathonsCodeEventMeetupCodeEventNodeSchoolCodeEventNoneCodeEventOtherCodeEventRailsBridgeCodeEventRailsGirlsCodeEventStartUpWkndCodeEventWkdBootcampsCodeEventWomenCodeCodeEventWorkshopsCommuteTimeCountryCitizenCountryLiveEmploymentFieldEmploymentFieldOtherEmploymentStatusEmploymentStatusOtherExpectedEarningFinanciallySupportingFirstDevJobGenderGenderOtherHasChildrenHasDebtHasFinancialDependentsHasHighSpdInternetHasHomeMortgageHasServedInMilitaryHasStudentDebtHomeMortgageOweHoursLearningID.xID.yIncomeIsEthnicMinorityIsReceiveDisabilitiesBenefitsIsSoftwareDevIsUnderEmployedJobApplyWhenJobInterestBackEndJobInterestDataEngrJobInterestDataSciJobInterestDevOpsJobInterestFrontEndJobInterestFullStackJobInterestGameDevJobInterestInfoSecJobInterestMobileJobInterestOtherJobInterestProjMngrJobInterestQAEngrJobInterestUXJobPrefJobRelocateYesNoJobRoleInterestJobWherePrefLanguageAtHomeMaritalStatusMoneyForLearningMonthsProgrammingNetworkIDPart1EndTimePart1StartTimePart2EndTimePart2StartTimePodcastChangeLogPodcastCodeNewbiePodcastCodePenPodcastDevTeaPodcastDotNETPodcastGiantRobotsPodcastJSAirPodcastJSJabberPodcastNonePodcastOtherPodcastProgThrowdownPodcastRubyRoguesPodcastSEDailyPodcastSERadioPodcastShopTalkPodcastTalkPythonPodcastTheWebAheadResourceCodecademyResourceCodeWarsResourceCourseraResourceCSSResourceEdXResourceEggheadResourceFCCResourceHackerRankResourceKAResourceLyndaResourceMDNResourceOdinProjResourceOtherResourcePluralSightResourceSkillcrushResourceSOResourceTreehouseResourceUdacityResourceUdemyResourceW3SSchoolDegreeSchoolMajorStudentDebtOweYouTubeCodeCourseYouTubeCodingTrainYouTubeCodingTut360YouTubeComputerphileYouTubeDerekBanasYouTubeDevTipsYouTubeEngineeredTruthYouTubeFCCYouTubeFunFunFunctionYouTubeGoogleDevYouTubeLearnCodeYouTubeLevelUpTutsYouTubeMITYouTubeMozillaHacksYouTubeOtherYouTubeSimplilearnYouTubeTheNewBostonmoney_per_month
172824.00.0NaNNaNNaNNaNNaNbetween 100,000 and 1 millionNaNNaNNaN1.0NaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNIndiaIndiaNaNNaNA stay-at-home parent or homemakerNaN70000.0NaNNaNmaleNaNNaN0.00.01.0NaN0.0NaNNaN30.0d964ec629fd6d85a5bf27f7339f4fa6d950a8cf9cef1ae6a15da470e572b1b7aNaN0.00.00.0NaNWithin the next 6 months1.0NaNNaNNaN1.0NaNNaNNaN1.0NaN1.0NaN1.0work for a startup1.0User Experience Designer, Mobile Developer…in an office with other developersBengalisingle, never married20000.04.038d312a9902017-03-10 10:22:342017-03-10 10:17:422017-03-10 10:24:382017-03-10 10:22:40NaNNaNNaNNaNNaNNaN1.0NaNNaNNaNNaNNaNNaNNaNNaNNaNNaN1.0NaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaN1.01.0bachelor’s degreeComputer ProgrammingNaNNaNNaNNaNNaNNaNNaNNaN1.0NaNNaNNaNNaNNaNNaNNaNNaNNaN5000.000000
175520.00.0NaNNaNNaNNaNNaNmore than 1 millionNaNNaN1.0NaNNaN1.01.0NaNNaNNaNNaNNaNNaNNaNNaNNaNNaNIndiaIndiaNaNNaNNot working and not looking for workNaN100000.0NaNNaNmaleNaNNaN0.00.01.0NaN0.0NaNNaN10.0811bf953ef546460f5436fcf2baa532d81e2a4cab0543e14746c4a20ffdae17cNaN0.00.00.0NaNI haven’t decidedNaN1.0NaN1.01.01.0NaN1.0NaNNaNNaNNaNNaNwork for a multinational corporation1.0Information Security, Full-Stack Web Developer…no preferenceHindisingle, never married50000.015.04611a76b602017-03-10 10:48:312017-03-10 10:42:292017-03-10 10:51:372017-03-10 10:48:38NaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaN1.0NaNNaNNaNNaN1.01.01.0NaN1.0NaN1.0NaN1.01.0NaNNaNNaN1.0NaNNaNNaN1.01.01.0bachelor’s degreeComputer ScienceNaNNaNNaN1.0NaNNaNNaNNaN1.0NaNNaN1.0NaN1.0NaNNaNNaNNaN3333.333333
798928.00.0NaNNaNNaNNaNNaNbetween 100,000 and 1 million1.0NaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaN1.015 to 29 minutesIndiaIndiasoftware development and ITNaNEmployed for wagesNaN500000.01.0NaNmaleNaN0.01.01.01.00.00.01.0NaN20.0a6a5597bbbc2c282386d6675641b744ada7bbb54a8b26a379707be56b6c51e65300000.00.00.00.00.0more than 12 months from now1.0NaNNaNNaN1.01.01.0NaNNaNNaNNaNNaN1.0work for a multinational corporation1.0User Experience Designer, Back-End Web Devel…in an office with other developersMarathimarried or domestic partnership5000.01.0c47a447b5d2017-03-26 14:06:482017-03-26 14:02:412017-03-26 14:13:132017-03-26 14:07:17NaNNaNNaNNaNNaNNaNNaNNaNNaNNot listened to anything yet.NaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaN1.0NaNNaN1.0NaNNaNNaNNaNNaNNaNNaNNaNNaNNaNbachelor’s degreeAerospace and Aeronautical Engineering2500.0NaNNaNNaNNaNNaNNaNNaN1.0NaNNaNNaNNaNNaNNaNNaNNaNNaN5000.000000
812622.00.0NaNNaNNaNNaNNaNmore than 1 millionNaNNaNNaN1.0NaN1.0NaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNIndiaIndiaNaNNaNNot working but looking for workNaN80000.0NaNNaNmaleNaNNaN1.00.01.00.00.01.0NaN80.069e8ab9126baee49f66e3577aea7fd3c9f08092e82f709e63847ba88841247c0NaN0.00.00.0NaNI’m already applying1.0NaNNaNNaN1.01.0NaNNaNNaNNaNNaNNaNNaNwork for a startup1.0Back-End Web Developer, Full-Stack Web Develop…in an office with other developersMalayalamsingle, never married5000.01.00d3d1762a42017-03-27 07:10:172017-03-27 07:05:232017-03-27 07:12:212017-03-27 07:10:22NaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaN1.0NaN1.0NaNNaNNaNNaNNaNNaNNaNNaNNaN1.0NaNNaNNaNNaNbachelor’s degreeElectrical and Electronics Engineering10000.0NaNNaNNaNNaNNaNNaNNaNNaNNaN1.0NaNNaN1.0NaNNaNNaN1.05000.000000
1339819.00.0NaNNaNNaNNaNNaNmore than 1 millionNaNNaNNaNNaNNaNNaNNaNNaN1.0NaNNaNNaNNaNNaNNaNNaNNaNIndiaIndiaNaNNaNUnable to workNaN100000.0NaNNaNmaleNaNNaN0.00.00.0NaN0.0NaNNaN30.0b7fe7bc4edefc3a60eb48f977e4426e380ff09859ac475b70ac19b7b7369e953NaN0.00.00.0NaNI haven’t decidedNaNNaNNaNNaNNaNNaNNaNNaN1.0NaNNaNNaNNaNwork for a multinational corporation1.0Mobile Developerno preferenceHindisingle, never married20000.02.051a6f9a1a72017-04-01 00:31:252017-04-01 00:28:172017-04-01 00:33:442017-04-01 00:31:32NaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaN1.0NaNNaNNaN1.0bachelor’s degreeComputer ScienceNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaN10000.000000
1558727.00.0NaNNaNNaNNaNNaNmore than 1 millionNaNNaNNaNNaNNaN1.0NaNNaNNaNNaNNaNNaNNaNNaNNaNNaN15 to 29 minutesIndiaIndiasoftware development and ITNaNEmployed for wagesNaN65000.00.0NaNmaleNaN0.01.01.01.00.00.01.0NaN36.05a7394f24292cb82b72adb702886543a8bc7997217d4a57b22242471cc8d89ef60000.00.00.00.01.0I haven’t decidedNaNNaN1.0NaNNaN1.0NaNNaNNaNNaNNaNNaNNaNwork for a startupNaNFull-Stack Web Developer, Data Scientistfrom homeHindisingle, never married100000.024.08af0c2b6da2017-04-03 09:43:532017-04-03 09:39:382017-04-03 09:54:392017-04-03 09:43:57NaNNaNNaNNaNNaNNaNNaNNaNNaNNaN1.0NaNNaNNaNNaNNaNNaNNaNNaNNaNNaN1.0NaN1.0NaNNaN1.0NaNNaNNaNNaNNaN1.0NaNNaNNaN1.0bachelor’s degreeCommunications25000.0NaNNaNNaNNaNNaNNaNNaNNaNNaN1.01.0NaN1.0NaNNaNNaNNaN4166.666667

It seems that neither participant attended a bootcamp. Overall, it’s really hard to figure out from the data whether these persons really spent that much money with learning. The actual question of the survey was “Aside from university tuition, about how much money have you spent on learning to code so far (in US dollars)?”, so they might have misunderstood and thought university tuition is included. It seems safer to remove these two rows.


# Remove the outliers for India
only_4 = only_4.drop(india_outliers.index) # using the row labels

Looking back at the box plot above, we can also see more extreme outliers for the US (values over $6,000 per month). Let’s examine these participants in more detail.


# Examine the extreme outliers for the US
us_outliers = only_4[
    (only_4['CountryLive'] == 'United States of America') &
    (only_4['money_per_month'] >= 6000)]

us_outliers
AgeAttendedBootcampBootcampFinishBootcampLoanYesNoBootcampNameBootcampRecommendChildrenNumberCityPopulationCodeEventConferencesCodeEventDjangoGirlsCodeEventFCCCodeEventGameJamCodeEventGirlDevCodeEventHackathonsCodeEventMeetupCodeEventNodeSchoolCodeEventNoneCodeEventOtherCodeEventRailsBridgeCodeEventRailsGirlsCodeEventStartUpWkndCodeEventWkdBootcampsCodeEventWomenCodeCodeEventWorkshopsCommuteTimeCountryCitizenCountryLiveEmploymentFieldEmploymentFieldOtherEmploymentStatusEmploymentStatusOtherExpectedEarningFinanciallySupportingFirstDevJobGenderGenderOtherHasChildrenHasDebtHasFinancialDependentsHasHighSpdInternetHasHomeMortgageHasServedInMilitaryHasStudentDebtHomeMortgageOweHoursLearningID.xID.yIncomeIsEthnicMinorityIsReceiveDisabilitiesBenefitsIsSoftwareDevIsUnderEmployedJobApplyWhenJobInterestBackEndJobInterestDataEngrJobInterestDataSciJobInterestDevOpsJobInterestFrontEndJobInterestFullStackJobInterestGameDevJobInterestInfoSecJobInterestMobileJobInterestOtherJobInterestProjMngrJobInterestQAEngrJobInterestUXJobPrefJobRelocateYesNoJobRoleInterestJobWherePrefLanguageAtHomeMaritalStatusMoneyForLearningMonthsProgrammingNetworkIDPart1EndTimePart1StartTimePart2EndTimePart2StartTimePodcastChangeLogPodcastCodeNewbiePodcastCodePenPodcastDevTeaPodcastDotNETPodcastGiantRobotsPodcastJSAirPodcastJSJabberPodcastNonePodcastOtherPodcastProgThrowdownPodcastRubyRoguesPodcastSEDailyPodcastSERadioPodcastShopTalkPodcastTalkPythonPodcastTheWebAheadResourceCodecademyResourceCodeWarsResourceCourseraResourceCSSResourceEdXResourceEggheadResourceFCCResourceHackerRankResourceKAResourceLyndaResourceMDNResourceOdinProjResourceOtherResourcePluralSightResourceSkillcrushResourceSOResourceTreehouseResourceUdacityResourceUdemyResourceW3SSchoolDegreeSchoolMajorStudentDebtOweYouTubeCodeCourseYouTubeCodingTrainYouTubeCodingTut360YouTubeComputerphileYouTubeDerekBanasYouTubeDevTipsYouTubeEngineeredTruthYouTubeFCCYouTubeFunFunFunctionYouTubeGoogleDevYouTubeLearnCodeYouTubeLevelUpTutsYouTubeMITYouTubeMozillaHacksYouTubeOtherYouTubeSimplilearnYouTubeTheNewBostonmoney_per_month
71826.01.00.00.0The Coding Boot Camp at UCLA Extension1.0NaNmore than 1 million1.0NaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaN15 to 29 minutesUnited States of AmericaUnited States of Americaarchitecture or physical engineeringNaNEmployed for wagesNaN50000.0NaNNaNmaleNaNNaN0.00.00.0NaN0.0NaNNaN35.0796ae14c2acdee36eebc250a252abdafd9e44d73057fa5d322a071adc744bf0744500.00.00.00.01.0Within the next 6 months1.0NaNNaNNaN1.01.0NaNNaN1.0NaNNaNNaN1.0work for a startup1.0User Experience Designer, Full-Stack Web Dev…in an office with other developersEnglishsingle, never married8000.01.050dab3f7162017-03-09 21:26:352017-03-09 21:21:582017-03-09 21:29:102017-03-09 21:26:39NaN1.01.0NaNNaNNaNNaNNaNNaNNaNNaNNaN1.0NaNNaNNaNNaNNaN1.0NaNNaNNaNNaN1.0NaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNbachelor’s degreeArchitectureNaNNaNNaNNaNNaNNaNNaNNaN1.0NaNNaNNaNNaNNaNNaNNaNNaNNaN8000.000000
122232.01.00.00.0The Iron Yard1.0NaNbetween 100,000 and 1 millionNaNNaNNaNNaNNaNNaN1.0NaNNaNNaNNaNNaNNaNNaNNaNNaNNaNUnited States of AmericaUnited States of AmericaNaNNaNNot working and not looking for workNaN50000.0NaNNaNfemaleNaNNaN1.00.01.00.00.00.0NaN50.0bfabebb4293ac002d26a1397d00c7443590f0be70e80f1daf5a23eb7f4a72a3dNaN0.00.00.0NaNWithin the next 6 monthsNaNNaNNaNNaN1.0NaNNaNNaN1.0NaNNaNNaN1.0work for a nonprofit1.0Front-End Web Developer, Mobile Developer,…in an office with other developersEnglishsingle, never married13000.02.0e512c4bdd02017-03-10 02:14:112017-03-10 02:10:072017-03-10 02:15:322017-03-10 02:14:16NaNNaNNaNNaNNaNNaNNaN1.0NaNNaNNaNNaNNaNNaNNaNNaNNaN1.0NaNNaN1.0NaN1.01.0NaNNaNNaN1.0NaNNaN1.01.01.01.01.01.0NaNbachelor’s degreeAnthropologyNaNNaN1.0NaNNaNNaN1.0NaN1.0NaNNaN1.0NaNNaNNaNNaNNaNNaN6500.000000
318434.01.01.00.0We Can Code IT1.0NaNmore than 1 millionNaNNaNNaNNaNNaNNaN1.0NaNNaNNaNNaNNaNNaNNaNNaNNaNLess than 15 minutesNaNUnited States of Americasoftware development and ITNaNEmployed for wagesNaN60000.0NaNNaNmaleNaNNaN0.00.01.0NaN0.0NaNNaN10.05d4889491d9d25a255e57fd1c0022458585e8f8b9a838ef1abbe8c6f1891c04840000.00.00.00.00.0I haven’t decidedNaN1.01.01.0NaNNaNNaN1.0NaNNaNNaN1.01.0work for a medium-sized company0.0Quality Assurance Engineer, DevOps / SysAd…in an office with other developersEnglishsingle, never married9000.01.0e7bebaabd42017-03-11 23:34:162017-03-11 23:31:172017-03-11 23:36:022017-03-11 23:34:21NaN1.0NaNNaNNaNNaNNaNNaNNaNNaNNaNNaN1.0NaNNaNNaNNaNNaN1.0NaN1.0NaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaN1.0NaN1.01.01.0some college credit, no degreeNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaN9000.000000
393031.00.0NaNNaNNaNNaNNaNbetween 100,000 and 1 millionNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNUnited States of AmericaUnited States of AmericaNaNNaNNot working and not looking for workNaN100000.0NaNNaNmaleNaNNaN1.00.01.00.00.01.0NaN50.0e1d790033545934fbe5bb5b60e368cd97cf1e41682462c42ce48029abf77d43cNaN1.00.00.0NaNWithin the next 6 months1.0NaNNaN1.01.01.0NaNNaNNaNNaNNaNNaNNaNwork for a startup1.0DevOps / SysAdmin, Front-End Web Developer…no preferenceEnglishmarried or domestic partnership65000.06.075759e5a1c2017-03-13 10:06:462017-03-13 09:56:132017-03-13 10:10:002017-03-13 10:06:50NaNNaNNaNNaNNaNNaN1.01.0NaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaN1.01.0NaNNaNNaN1.0NaNreactivex.io/learnrx/ & jafar husainNaNNaN1.0NaNNaNNaNNaNbachelor’s degreeBiology40000.0NaNNaNNaNNaNNaNNaN1.01.01.01.01.01.01.0NaNvarious conf presentationsNaNNaN10833.333333
680546.01.01.01.0Sabio.la0.0NaNbetween 100,000 and 1 millionNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNUnited States of AmericaUnited States of AmericaNaNNaNNot working but looking for workNaN70000.0NaNNaNmaleNaNNaN1.00.01.00.00.01.0NaN45.069096aacf4245694303cf8f7ce68a63f4c56f82a348836e76dd90d18a3d5ed88NaN1.00.00.0NaNWithin the next 6 monthsNaN1.01.0NaNNaN1.01.0NaNNaNNaN1.0NaNNaNwork for a multinational corporation1.0Full-Stack Web Developer, Game Developer, Pr…no preferenceEnglishmarried or domestic partnership15000.01.053d13b58e92017-03-21 20:13:082017-03-21 20:10:252017-03-21 20:14:362017-03-21 20:13:11NaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaN1.0NaNNaNNaNNaNNaN1.0NaNNaNNaNNaNNaNNaNNaNNaN1.01.01.01.01.0bachelor’s degreeBusiness Administration and Management45000.0NaNNaNNaNNaNNaNNaNNaN1.0NaNNaNNaNNaNNaNNaNNaNNaNNaN15000.000000
719832.00.0NaNNaNNaNNaNNaNmore than 1 million1.0NaNNaNNaNNaNNaN1.0NaNNaNNaNNaNNaNNaNNaNNaNNaN15 to 29 minutesUnited States of AmericaUnited States of AmericaeducationNaNEmployed for wagesNaN55000.0NaNNaNmaleNaNNaN1.00.01.00.00.01.0NaN4.0cb2754165344e6be79da8a4c76bf3917272219fbd28a3a7562cb1d778e482e1eNaN1.00.00.00.0I’m already applying1.0NaNNaNNaNNaN1.0NaNNaNNaNNaNNaNNaNNaNwork for a multinational corporation0.0Full-Stack Web Developer, Back-End Web Developerno preferenceSpanishsingle, never married70000.05.0439a4adaf62017-03-23 01:37:462017-03-23 01:35:012017-03-23 01:39:372017-03-23 01:37:49NaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaN1.0NaN1.01.0NaNNaN1.0NaN1.0NaN1.0NaNNaNNaNNaN1.0NaN1.0NaN1.0professional degree (MBA, MD, JD, etc.)Computer ScienceNaNNaNNaNNaNNaNNaNNaNNaN1.0NaN1.01.01.0NaNNaNNaNNaNNaN14000.000000
750526.01.00.01.0Codeup0.0NaNmore than 1 millionNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaN1.0NaNNaNNaNNaNUnited States of AmericaUnited States of AmericaNaNNaNNot working but looking for workNaN65000.0NaNNaNmaleNaNNaN1.00.01.00.00.01.0NaN40.0657fb50800bcc99a07caf52387f67fbbad1df4669883d8f628f0b5598a4c5c45NaN0.00.00.0NaNWithin the next 6 months1.0NaNNaNNaN1.01.0NaN1.01.0NaNNaNNaNNaNwork for a government1.0Mobile Developer, Full-Stack Web Developer, …in an office with other developersEnglishsingle, never married20000.03.096e254de362017-03-24 03:26:092017-03-24 03:23:022017-03-24 03:27:472017-03-24 03:26:14NaNNaNNaN1.0NaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaN1.0NaNNaNNaNNaNNaN1.0NaNNaN1.0NaNNaNNaN1.0NaN1.0NaNNaN1.01.0bachelor’s degreeEconomics20000.0NaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaN1.0NaNNaNNaNNaN6666.666667
977833.01.00.01.0Grand Circus1.0NaNbetween 100,000 and 1 millionNaNNaNNaNNaNNaNNaN1.0NaNNaNNaNNaNNaNNaNNaNNaNNaN15 to 29 minutesUnited States of AmericaUnited States of AmericaeducationNaNEmployed for wagesNaN55000.0NaNNaNmaleNaNNaN1.00.01.00.00.01.0NaN40.07a62790f6ded15e26d5f429b8a4d109598eeee1aa81ba70b2ab288bf4b63d70320000.00.00.00.01.0Within the next 6 months1.01.01.0NaNNaN1.0NaNNaN1.0NaNNaN1.0NaNwork for a medium-sized companyNaNFull-Stack Web Developer, Data Engineer, Qua…from homeEnglishsingle, never married8000.01.0ea80a3b15e2017-04-05 19:48:122017-04-05 19:40:192017-04-05 19:49:442017-04-05 19:49:03NaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaN1.0NaNNaNNaNNaNNaNNaNNaNNaN1.01.01.0NaNNaNmaster’s degree (non-professional)Chemical Engineering45000.0NaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaN8000.000000
1665029.00.0NaNNaNNaNNaN2.0more than 1 millionNaNNaNNaNNaNNaNNaN1.0NaNNaNNaNNaNNaNNaNNaNNaNNaNNaNUnited States of AmericaUnited States of AmericaNaNNaNNot working but looking for workNaNNaN1.0NaNmaleNaN1.01.01.01.01.00.01.0400000.040.0e1925d408c973b91cf3e9a92852387967e9e3c31a3dc2cafe3a09269398c4de8NaN1.01.00.0NaNI’m already applying1.01.0NaNNaN1.01.01.0NaNNaNNaN1.0NaNNaNwork for a multinational corporation1.0Product Manager, Data Engineer, Full-Stack W…in an office with other developersEnglishmarried or domestic partnership200000.012.01a45f4a3ef2017-03-14 02:42:572017-03-14 02:40:102017-03-14 02:45:552017-03-14 02:43:05NaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaN1.0NaNNaNNaN1.0NaNNaNNaNNaNNaNNaNNaNNaNNaNNaN1.0NaN1.0associate’s degreeComputer Programming30000.0NaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaN1.016666.666667
1699727.00.0NaNNaNNaNNaN1.0more than 1 millionNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaN15 to 29 minutesUnited States of AmericaUnited States of Americahealth careNaNEmployed for wagesNaN60000.00.0NaNfemaleNaN1.01.01.01.00.00.01.0NaN12.0624914ce07c296c866c9e16a14dc01c76384a1e576caf4b6b9339fe496a51f1f40000.01.00.00.00.0Within 7 to 12 monthsNaNNaNNaNNaN1.01.01.0NaN1.0NaN1.0NaN1.0work for a medium-sized company1.0Mobile Developer, Game Developer, User Exp…in an office with other developersEnglishsingle, never married12500.01.0ad1a21217c2017-03-20 05:43:282017-03-20 05:40:082017-03-20 05:45:282017-03-20 05:43:32NaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaN1.0NaNNaNNaNNaNNaN1.0NaNNaNNaNNaNNaNNaNNaNNaN1.0NaNNaN1.01.0some college credit, no degreeNaN12500.0NaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaN12500.000000
1723150.00.0NaNNaNNaNNaN2.0less than 100,000NaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaN1.0NaNNaNKenyaUnited States of AmericaNaNNaNNot working but looking for workNaN40000.00.0NaNfemaleNaN1.00.01.01.0NaN0.0NaNNaN1.0d4bc6ae775b20816fcd41048ef75417c606749cd07b124234ab6dff81b324c02NaN1.00.00.0NaNWithin the next 6 monthsNaNNaNNaNNaN1.0NaNNaNNaNNaNNaNNaNNaNNaNwork for a nonprofit0.0Front-End Web Developerin an office with other developersEnglishmarried or domestic partnership30000.02.038c1b478d02017-03-24 18:48:232017-03-24 18:46:012017-03-24 18:51:202017-03-24 18:48:27NaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaN1.0NaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaN1.0NaNbachelor’s degreeComputer ProgrammingNaNNaNNaNNaNNaN1.0NaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaN15000.000000

Out of these 11 extreme outliers, 6 people attended bootcamps, which justifies the large sums of money spent on learning. For the other five, it’s hard to figure out from the data where they could have spent that much money on learning. Consequently, we’ll remove those rows where participants reported thay they spend $6,000 each month, but they have never attended a bootcamp.

Also, the data shows that eight respondents had been programming for no more than three months when they completed the survey. They most likely paid a large sum of money for a bootcamp that was going to last for several months, so the amount of money spent per month is unrealistic and should be significantly lower (because they probably didn’t spend anything for the next couple of months after the survey). As a consequence, we’ll remove every these eight outliers.

In the next code block, we’ll remove respondents that:

  • Didn’t attend bootcamps.
  • Had been programming for three months or less when at the time they completed the survey.

# Remove the respondents who didn't attendent a bootcamp
no_bootcamp = only_4[
     (only_4['CountryLive'] == 'United States of America') &
     (only_4['money_per_month'] >= 6000) &
     (only_4['AttendedBootcamp'] == 0)
]
only_4 = only_4.drop(no_bootcamp.index)

# Remove the respondents that had been programming for less than 3 months
less_than_3_months = only_4[
    (only_4['CountryLive'] == 'United States of America') &
    (only_4['money_per_month'] >= 6000) &
    (only_4['MonthsProgramming'] <= 3)

]

only_4 = only_4.drop(less_than_3_months.index)

Looking again at the last box plot above, we can also see an extreme outlier for Canada — a person who spends roughly $5,000 per month. Let’s examine this person in more depth.


# Examine the extreme outliers for Canada
canada_outliers = only_4[
    (only_4['CountryLive'] == 'Canada') &
    (only_4['money_per_month'] > 4500)]

canada_outliers
AgeAttendedBootcampBootcampFinishBootcampLoanYesNoBootcampNameBootcampRecommendChildrenNumberCityPopulationCodeEventConferencesCodeEventDjangoGirlsCodeEventFCCCodeEventGameJamCodeEventGirlDevCodeEventHackathonsCodeEventMeetupCodeEventNodeSchoolCodeEventNoneCodeEventOtherCodeEventRailsBridgeCodeEventRailsGirlsCodeEventStartUpWkndCodeEventWkdBootcampsCodeEventWomenCodeCodeEventWorkshopsCommuteTimeCountryCitizenCountryLiveEmploymentFieldEmploymentFieldOtherEmploymentStatusEmploymentStatusOtherExpectedEarningFinanciallySupportingFirstDevJobGenderGenderOtherHasChildrenHasDebtHasFinancialDependentsHasHighSpdInternetHasHomeMortgageHasServedInMilitaryHasStudentDebtHomeMortgageOweHoursLearningID.xID.yIncomeIsEthnicMinorityIsReceiveDisabilitiesBenefitsIsSoftwareDevIsUnderEmployedJobApplyWhenJobInterestBackEndJobInterestDataEngrJobInterestDataSciJobInterestDevOpsJobInterestFrontEndJobInterestFullStackJobInterestGameDevJobInterestInfoSecJobInterestMobileJobInterestOtherJobInterestProjMngrJobInterestQAEngrJobInterestUXJobPrefJobRelocateYesNoJobRoleInterestJobWherePrefLanguageAtHomeMaritalStatusMoneyForLearningMonthsProgrammingNetworkIDPart1EndTimePart1StartTimePart2EndTimePart2StartTimePodcastChangeLogPodcastCodeNewbiePodcastCodePenPodcastDevTeaPodcastDotNETPodcastGiantRobotsPodcastJSAirPodcastJSJabberPodcastNonePodcastOtherPodcastProgThrowdownPodcastRubyRoguesPodcastSEDailyPodcastSERadioPodcastShopTalkPodcastTalkPythonPodcastTheWebAheadResourceCodecademyResourceCodeWarsResourceCourseraResourceCSSResourceEdXResourceEggheadResourceFCCResourceHackerRankResourceKAResourceLyndaResourceMDNResourceOdinProjResourceOtherResourcePluralSightResourceSkillcrushResourceSOResourceTreehouseResourceUdacityResourceUdemyResourceW3SSchoolDegreeSchoolMajorStudentDebtOweYouTubeCodeCourseYouTubeCodingTrainYouTubeCodingTut360YouTubeComputerphileYouTubeDerekBanasYouTubeDevTipsYouTubeEngineeredTruthYouTubeFCCYouTubeFunFunFunctionYouTubeGoogleDevYouTubeLearnCodeYouTubeLevelUpTutsYouTubeMITYouTubeMozillaHacksYouTubeOtherYouTubeSimplilearnYouTubeTheNewBostonmoney_per_month
1365924.01.00.00.0Bloc.io1.0NaNmore than 1 million1.0NaN1.0NaNNaNNaN1.0NaNNaNNaNNaNNaNNaNNaNNaN1.030 to 44 minutesCanadaCanadafinanceNaNEmployed for wagesNaN60000.0NaNNaNmaleNaNNaN1.00.01.01.00.00.0250000.010.0739b584aef0541450c1f713b8202518128381a455ab25cc2a118d78af44d8749140000.01.01.00.00.0I haven’t decided1.0NaN1.0NaN1.01.01.0NaN1.0NaN1.0NaN1.0work for a multinational corporationNaNMobile Developer, Full-Stack Web Developer, …from homeYue (Cantonese) Chinesesingle, never married10000.02.041c26f29322017-03-25 23:23:032017-03-25 23:20:332017-03-25 23:24:342017-03-25 23:23:06NaNNaNNaNNaNNaNNaNNaNNaN1.0NaNNaNNaNNaNNaNNaNNaNNaN1.01.01.0NaNNaNNaN1.0NaNNaNNaNNaNNaNNaNNaNNaN1.0NaNNaNNaN1.0bachelor’s degreeFinanceNaNNaNNaNNaNNaNNaNNaNNaN1.0NaNNaNNaNNaN1.0NaNNaNNaNNaN5000.0

Here, the situation is similar to some of the US respondents — this participant had been programming for no more than two months when he completed the survey. He seems to have paid a large sum of money in the beginning to enroll in a bootcamp, and then he probably didn’t spend anything for the next couple of months after the survey. We’ll take the same approach here as for the US and remove this outlier.


# Remove the extreme outliers for Canada
only_4 = only_4.drop(canada_outliers.index)

Let’s recompute the mean values and generate the final box plots.


# Recompute mean sum of money spent by students each month
only_4.groupby('CountryLive').mean()['money_per_month']

CountryLive
Canada                       93.065400
India                        65.758763
United Kingdom               45.534443
United States of America    142.654608
Name: money_per_month, dtype: float64

# Visualize the distributions again
sns.boxplot(y = 'money_per_month', x = 'CountryLive',
            data = only_4)
plt.title('Money Spent Per Month Per Country\n(Distributions)',
          fontsize = 16)
plt.ylabel('Money per month (US dollars)')
plt.xlabel('Country')
plt.xticks(range(4), ['US', 'UK', 'India', 'Canada']) # avoids tick labels overlap
plt.show()

Stats2_39_0

Choosing the two best advertising markets

Obviously, one country we should advertise in is the US. Lots of new coders live there and they are willing to pay a good amount of money each month (roughly $143).

We sell subscriptions at a price of \$59 per month, and Canada seems to be the best second choice because people there are willing to pay roughly \$93 per month, compared to India (\$66) and the United Kingdom (\$45).

The data suggests strongly that we shouldn’t advertise in the UK, but let’s take a second look at India before deciding to choose Canada as our second best choice:

  • \$59 doesn’t seem like an expensive sum for people in India since they spend on average $66 each month.
  • We have almost twice as more potential customers in India than we have in Canada:

# Frequency table for the 'CountryLive' column
only_4['CountryLive'].value_counts(normalize = True) * 100

United States of America    74.967908
India                       11.732991
United Kingdom               7.163030
Canada                       6.136072
Name: CountryLive, dtype: float64

It’s not crystal clear what to choose between Canada and India. Although it seems more tempting to choose Canada, there are good chances that India might actually be a better choice because of the large number of potential customers.

At this point, it seems that we have several options:

  1. Advertise in the US, India, and Canada by splitting the advertisement budget in various combinations:
    • 60% for the US, 25% for India, 15% for Canada.
    • 50% for the US, 30% for India, 20% for Canada; etc.
  2. Advertise only in the US and India, or the US and Canada. Again, it makes sense to split the advertisement budget unequally. For instance:
    • 70% for the US, and 30% for India.
    • 65% for the US, and 35% for Canada; etc.
  3. Advertise only in the US.

It’s probably best to send our analysis to the marketing team and let them use their domain knowledge to decide. They might want to do some extra surveys in India and Canada and then get back to us for analyzing the new survey data.

Conclusion

In this project, we analyzed survey data from new coders to find the best two markets to advertise in. The only solid conclusion we reached is that the US would be a good market to advertise in.

For the second best market, it wasn’t clear-cut what to choose between India and Canada. We decided to send the results to the marketing team so they can use their domain knowledge to take the best decision.


Tags

Data Science Projects, Matplotlib, Pandas, stats


You may also like

Get started with Dataquest today - for free!

__CONFIG_colors_palette__{"active_palette":0,"config":{"colors":{"493ef":{"name":"Main Accent","parent":-1}},"gradients":[]},"palettes":[{"name":"Default Palette","value":{"colors":{"493ef":{"val":"rgb(44, 168, 116)","hsl":{"h":154,"s":0.58,"l":0.42}}},"gradients":[]},"original":{"colors":{"493ef":{"val":"rgb(19, 114, 211)","hsl":{"h":210,"s":0.83,"l":0.45}}},"gradients":[]}}]}__CONFIG_colors_palette__
Sign up now

Or, visit our pricing page to learn about our Basic and Premium plans.

(function(d) { d.addEventListener("DOMContentLoaded", function() { var pathname = d.location.pathname.replace(/^[/]|[/]$/g, "").replace("/", "-"); var tags = d.getElementsByTagName("iframe"); var type = pathname.startsWith("course") ? "?course=" : pathname.startsWith("path") ? "?path=" : null; if (type) { var i; for (i = 0; i < tags.length; i++) { if (tags[i].src.indexOf("signup#iframe") !== -1) { tags[i].src = tags[i].src.replace("#iframe", "") + type + pathname + "#iframe"; } } } }, false); })(document);