This analysis uses the 2020 survey data from StackOverflow to get a glimpse into where women are in the tech world. This project is the course project for the Data Analysis with Python: Zero to Pandas course. This project is an extension to "Lesson 6 - Exploratory Data Analysis - A Case Study" of the course.
The course is a hands-on introductory to data analysis using Python programming language along with fundamental but essential library packages for data analysis and visualization. The dataset contains responses from software development community on Stack Overflow (stackoverflow.com).
#TODO - Write some introduction about your project here: describe the dataset, where you got it from, what you're trying to do with it, and which tools & techniques you're using. You can also mention about the course Data Analysis with Python: Zero to Pandas, and what you've learned from it.
This is an executable Jupyter notebook hosted on Jovian.ml, a platform for sharing data science projects. You can run and experiment with the code in a couple of ways: using free online resources (recommended) or on your own computer.
The easiest way to start executing this notebook is to click the "Run" button at the top of this page, and select "Run on Binder". This will run the notebook on mybinder.org, a free online service for running Jupyter notebooks. You can also select "Run on Colab" or "Run on Kaggle".
Install Conda by following these instructions. Add Conda binaries to your system PATH
, so you can use the conda
command on your terminal.
Create a Conda environment and install the required libraries by running these commands on the terminal:
conda create -n zerotopandas -y python=3.8
conda activate zerotopandas
pip install jovian jupyter numpy pandas matplotlib seaborn opendatasets --upgrade
jovian clone notebook-owner/notebook-id
cd directory-name
and start the Jupyter notebook.jupyter notebook
You can now access Jupyter's web interface by clicking the link that shows up on the terminal or by visiting http://localhost:8888 on your browser. Click on the notebook file (it has a .ipynb
extension) to open it.
Use the jovian opendatasets library to retrieve the CSV file from stackoverflow.com
!pip install jovian opendatasets --upgrade --quiet
Let's begin by downloading the data, and listing the files within the dataset.
# Change this
dataset_url = 'stackoverflow-developer-survey-2020'
import opendatasets as od
od.download(dataset_url)
Using downloaded and verified file: .\stackoverflow-developer-survey-2020\survey_results_public.csv
Using downloaded and verified file: .\stackoverflow-developer-survey-2020\survey_results_schema.csv
Using downloaded and verified file: .\stackoverflow-developer-survey-2020\README.txt
The dataset has been downloaded and extracted.
# Change this
data_dir = './stackoverflow-developer-survey-2020'
import os
os.listdir(data_dir)
['README.txt', 'survey_results_public.csv', 'survey_results_schema.csv']
Let us save and upload our work to Jovian before continuing.
project_name = "women-in-tech"
!pip install jovian --upgrade -q
import jovian
jovian.commit(project=project_name)
[jovian] Attempting to save notebook..
[jovian] Updating notebook "nguyen6174/women-in-tech" on https://jovian.ml/
[jovian] Uploading notebook..
[jovian] Capturing environment..
[jovian] Committed successfully! https://jovian.ml/nguyen6174/women-in-tech
Preparing data for analysis of how women are involved in software technologies
Areas of interest are from the data are: gender, age, how respondents use software technologies.
Instructions (delete this cell):
- Load the dataset into a data frame using Pandas
- Explore the number of rows & columns, ranges of values etc.
- Handle missing, incorrect and invalid data
- Perform any additional steps (parsing dates, creating additional columns, merging multiple dataset etc.)
import pandas as pd
so_raw_df = pd.read_csv('stackoverflow-developer-survey-2020/survey_results_public.csv')
so_raw_df
so_raw_df.columns
Index(['Respondent', 'MainBranch', 'Hobbyist', 'Age', 'Age1stCode', 'CompFreq',
'CompTotal', 'ConvertedComp', 'Country', 'CurrencyDesc',
'CurrencySymbol', 'DatabaseDesireNextYear', 'DatabaseWorkedWith',
'DevType', 'EdLevel', 'Employment', 'Ethnicity', 'Gender', 'JobFactors',
'JobSat', 'JobSeek', 'LanguageDesireNextYear', 'LanguageWorkedWith',
'MiscTechDesireNextYear', 'MiscTechWorkedWith',
'NEWCollabToolsDesireNextYear', 'NEWCollabToolsWorkedWith', 'NEWDevOps',
'NEWDevOpsImpt', 'NEWEdImpt', 'NEWJobHunt', 'NEWJobHuntResearch',
'NEWLearn', 'NEWOffTopic', 'NEWOnboardGood', 'NEWOtherComms',
'NEWOvertime', 'NEWPurchaseResearch', 'NEWPurpleLink', 'NEWSOSites',
'NEWStuck', 'OpSys', 'OrgSize', 'PlatformDesireNextYear',
'PlatformWorkedWith', 'PurchaseWhat', 'Sexuality', 'SOAccount',
'SOComm', 'SOPartFreq', 'SOVisitFreq', 'SurveyEase', 'SurveyLength',
'Trans', 'UndergradMajor', 'WebframeDesireNextYear',
'WebframeWorkedWith', 'WelcomeChange', 'WorkWeekHrs', 'YearsCode',
'YearsCodePro'],
dtype='object')
schema_csv = 'stackoverflow-developer-survey-2020/survey_results_schema.csv'
survey_questions = pd.read_csv(schema_csv, index_col='Column').QuestionText
survey_questions
Column
Respondent Randomized respondent ID number (not in order ...
MainBranch Which of the following options best describes ...
Hobbyist Do you code as a hobby?
Age What is your age (in years)? If you prefer not...
Age1stCode At what age did you write your first line of c...
...
WebframeWorkedWith Which web frameworks have you done extensive d...
WelcomeChange Compared to last year, how welcome do you feel...
WorkWeekHrs On average, how many hours per week do you wor...
YearsCode Including any education, how many years have y...
YearsCodePro NOT including education, how many years have y...
Name: QuestionText, Length: 61, dtype: object
survey_questions['NEWEdImpt']
'How important is a formal education, such as a university degree in computer science, to your career?'
survey_questions['DevType']
'Which of the following describe you? Please select all that apply.'
survey_questions['NEWLearn']
'How frequently do you learn a new language or framework?'
survey_questions['JobSat']
'How satisfied are you with your current job? (If you work multiple jobs, answer for the one you spend the most hours on.)'
survey_questions['NEWOvertime']
'How often do you work overtime or beyond the formal time expectation of your job?'
selected_columns = [
# Demographics
'Country',
'Age',
'Gender',
'EdLevel',
'UndergradMajor',
# Programming experience
'Hobbyist',
'Age1stCode',
'YearsCode',
'YearsCodePro',
'LanguageWorkedWith',
'NEWLearn',
# Employment
'Employment',
'DevType',
'JobSat',
'NEWEdImpt'
]
#Make a copy of the reduced dataset
survey_df = so_raw_df[selected_columns].copy()
survey_df.shape
(64461, 15)
survey_df.info()
<class 'pandas.core.frame.DataFrame'>
RangeIndex: 64461 entries, 0 to 64460
Data columns (total 15 columns):
# Column Non-Null Count Dtype
--- ------ -------------- -----
0 Country 64072 non-null object
1 Age 45446 non-null float64
2 Gender 50557 non-null object
3 EdLevel 57431 non-null object
4 UndergradMajor 50995 non-null object
5 Hobbyist 64416 non-null object
6 Age1stCode 57900 non-null object
7 YearsCode 57684 non-null object
8 YearsCodePro 46349 non-null object
9 LanguageWorkedWith 57378 non-null object
10 NEWLearn 56156 non-null object
11 Employment 63854 non-null object
12 DevType 49370 non-null object
13 JobSat 45194 non-null object
14 NEWEdImpt 48465 non-null object
dtypes: float64(1), object(14)
memory usage: 7.4+ MB
#convert to numeric where making sense
survey_df['Age1stCode'] = pd.to_numeric(survey_df.Age1stCode, errors='coerce')
survey_df['YearsCode'] = pd.to_numeric(survey_df.YearsCode, errors='coerce')
survey_df['YearsCodePro'] = pd.to_numeric(survey_df.YearsCodePro, errors='coerce')
survey_df.head(5)
survey_df.describe()
# drop rows where age don't make sense
survey_df.drop(survey_df[survey_df.Age < 10].index, inplace=True)
survey_df.drop(survey_df[survey_df.Age > 100].index, inplace=True)
#analyze the Gender data
survey_df.Gender.value_counts()
Man 46007
Woman 3843
Non-binary, genderqueer, or gender non-conforming 385
Man;Non-binary, genderqueer, or gender non-conforming 121
Woman;Non-binary, genderqueer, or gender non-conforming 92
Woman;Man 74
Woman;Man;Non-binary, genderqueer, or gender non-conforming 26
Name: Gender, dtype: int64
import jovian
jovian.commit()
[jovian] Attempting to save notebook..
[jovian] Updating notebook "nguyen6174/women-in-tech" on https://jovian.ml/
[jovian] Uploading notebook..
[jovian] Capturing environment..
[jovian] Committed successfully! https://jovian.ml/nguyen6174/women-in-tech
TODO - write some explanation here.
Instructions (delete this cell)
- Compute the mean, sum, range and other interesting statistics for numeric columns
- Explore distributions of numeric columns using histograms etc.
- Explore relationship between columns using scatter plots, bar charts etc.
- Make a note of interesting insights from the exploratory analysis
Let's begin by importingmatplotlib.pyplot
and seaborn
.
import seaborn as sns
import matplotlib
import matplotlib.pyplot as plt
%matplotlib inline
sns.set_style('darkgrid')
matplotlib.rcParams['font.size'] = 14
matplotlib.rcParams['figure.figsize'] = (9, 5)
matplotlib.rcParams['figure.facecolor'] = '#00000000'
Women in age group
survey_df.Gender.value_counts()
Man 46007
Woman 3843
Non-binary, genderqueer, or gender non-conforming 385
Man;Non-binary, genderqueer, or gender non-conforming 121
Woman;Non-binary, genderqueer, or gender non-conforming 92
Woman;Man 74
Woman;Man;Non-binary, genderqueer, or gender non-conforming 26
Name: Gender, dtype: int64
# Get respondent data where Gender contains 'Woman'
import numpy as np
survey_df.where((survey_df.Gender.str.contains('Woman',na=False)), np.nan, inplace=True)
survey_df.Gender.value_counts()
Woman 3843
Woman;Non-binary, genderqueer, or gender non-conforming 92
Woman;Man 74
Woman;Man;Non-binary, genderqueer, or gender non-conforming 26
Name: Gender, dtype: int64
TODO - Explore one or more columns by plotting a graph below, and add some explanation about it
TODO - Explore one or more columns by plotting a graph below, and add some explanation about it
TODO - Explore one or more columns by plotting a graph below, and add some explanation about it
TODO - Explore one or more columns by plotting a graph below, and add some explanation about it
Let us save and upload our work to Jovian before continuing
import jovian
jovian.commit()
TODO - write some explanation here.
Instructions (delete this cell)
- Ask at least 5 interesting questions about your dataset
- Answer the questions either by computing the results using Numpy/Pandas or by plotting graphs using Matplotlib/Seaborn
- Create new columns, merge multiple dataset and perform grouping/aggregation wherever necessary
- Wherever you're using a library function from Pandas/Numpy/Matplotlib etc. explain briefly what it does
Let us save and upload our work to Jovian before continuing.
import jovian
jovian.commit()
TODO - Write some explanation here: a summary of all the inferences drawn from the analysis, and any conclusions you may have drawn by answering various questions.
import jovian
jovian.commit()
TODO - Write some explanation here: ideas for future projects using this dataset, and links to resources you found useful.
Submission Instructions (delete this cell)
- Upload your notebook to your Jovian.ml profile using
jovian.commit
.- Make a submission here: https://jovian.ml/learn/data-analysis-with-python-zero-to-pandas/assignment/course-project
- Share your work on the forum: https://jovian.ml/forum/t/course-project-on-exploratory-data-analysis-discuss-and-share-your-work/11684
- Share your work on social media (Twitter, LinkedIn, Telegram etc.) and tag @JovianML
(Optional) Write a blog post
- A blog post is a great way to present and showcase your work.
- Sign up on Medium.com to write a blog post for your project.
- Copy over the explanations from your Jupyter notebook into your blog post, and embed code cells & outputs
- Check out the Jovian.ml Medium publication for inspiration: https://medium.com/jovianml
import jovian
jovian.commit()