Created
April 17, 2019 08:34
-
-
Save sirex/1243e4f29e34f3ca0ddb78258704ab81 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"cells": [ | |
{ | |
"cell_type": "markdown", | |
"metadata": {}, | |
"source": [ | |
"Stack Overflow Survey data can be downloaded from here:\n", | |
"\n", | |
"https://insights.stackoverflow.com/survey" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 4, | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"name": "stdout", | |
"output_type": "stream", | |
"text": [ | |
"Downloading to \"stackoverflow-survey-2018.zip\"\n", | |
"\u001b[KDone. 19.10 MB in 5.32119s (3.59 MB/s)\n" | |
] | |
} | |
], | |
"source": [ | |
"!http -b -d 'https://drive.google.com/uc?export=download&id=1_9On2-nsBQIw3JiY43sWbrF8EjrqrR4U' -o stackoverflow-survey-2018.zip" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 5, | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"name": "stdout", | |
"output_type": "stream", | |
"text": [ | |
"Archive: stackoverflow-survey-2018.zip\n", | |
" inflating: survey_results_public.csv \n", | |
" inflating: Developer_Survey_Instrument_2018.pdf \n", | |
" creating: __MACOSX/\n", | |
" inflating: __MACOSX/._Developer_Survey_Instrument_2018.pdf \n", | |
" inflating: survey_results_schema.csv \n", | |
" inflating: README_2018.txt \n" | |
] | |
} | |
], | |
"source": [ | |
"!unzip stackoverflow-survey-2018.zip" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 6, | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"name": "stdout", | |
"output_type": "stream", | |
"text": [ | |
"Populating the interactive namespace from numpy and matplotlib\n" | |
] | |
} | |
], | |
"source": [ | |
"%pylab inline" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 7, | |
"metadata": {}, | |
"outputs": [], | |
"source": [ | |
"import pandas as pd" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 10, | |
"metadata": {}, | |
"outputs": [], | |
"source": [ | |
"survey = pd.read_csv('survey_results_public.csv', low_memory=False)" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 17, | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"data": { | |
"text/plain": [ | |
"257" | |
] | |
}, | |
"execution_count": 17, | |
"metadata": {}, | |
"output_type": "execute_result" | |
} | |
], | |
"source": [ | |
"survey[survey.Country == 'Lithuania'].shape[0]" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 48, | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"data": { | |
"text/plain": [ | |
"JavaScript 136\n", | |
"HTML 133\n", | |
"CSS 126\n", | |
"SQL 125\n", | |
"Java 89\n", | |
"C# 81\n", | |
"Bash/Shell 79\n", | |
"PHP 76\n", | |
"Python 57\n", | |
"C++ 49\n", | |
"C 35\n", | |
"TypeScript 30\n", | |
"Ruby 18\n", | |
"Go 14\n", | |
"Swift 13\n", | |
"Scala 10\n", | |
"Kotlin 10\n", | |
"Lua 9\n", | |
"Objective-C 9\n", | |
"Groovy 8\n", | |
"Assembly 7\n", | |
"VB.NET 7\n", | |
"Delphi/Object Pascal 7\n", | |
"VBA 7\n", | |
"R 6\n", | |
"Perl 5\n", | |
"Matlab 5\n", | |
"CoffeeScript 4\n", | |
"F# 3\n", | |
"Rust 3\n", | |
"Visual Basic 6 3\n", | |
"Ocaml 1\n", | |
"Haskell 1\n", | |
"dtype: int64" | |
] | |
}, | |
"execution_count": 48, | |
"metadata": {}, | |
"output_type": "execute_result" | |
} | |
], | |
"source": [ | |
"survey[survey.Country == 'Lithuania'] \\\n", | |
" .LanguageWorkedWith.str.split(';') \\\n", | |
" .apply(pd.Series, 1) \\\n", | |
" .unstack() \\\n", | |
" .reset_index(drop=True, level=0) \\\n", | |
" .dropna() \\\n", | |
" .value_counts()" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 49, | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"data": { | |
"text/plain": [ | |
"JavaScript 89\n", | |
"SQL 72\n", | |
"Python 60\n", | |
"HTML 58\n", | |
"C# 58\n", | |
"CSS 55\n", | |
"Bash/Shell 52\n", | |
"Java 51\n", | |
"C++ 46\n", | |
"TypeScript 38\n", | |
"PHP 35\n", | |
"Go 32\n", | |
"Kotlin 31\n", | |
"C 27\n", | |
"Rust 23\n", | |
"Scala 20\n", | |
"Assembly 15\n", | |
"Swift 14\n", | |
"F# 12\n", | |
"Haskell 11\n", | |
"R 10\n", | |
"Lua 8\n", | |
"Ruby 8\n", | |
"Objective-C 6\n", | |
"Groovy 5\n", | |
"Clojure 5\n", | |
"Erlang 4\n", | |
"Delphi/Object Pascal 4\n", | |
"CoffeeScript 4\n", | |
"Hack 3\n", | |
"Perl 3\n", | |
"Ocaml 3\n", | |
"VBA 3\n", | |
"Matlab 2\n", | |
"Visual Basic 6 2\n", | |
"VB.NET 1\n", | |
"dtype: int64" | |
] | |
}, | |
"execution_count": 49, | |
"metadata": {}, | |
"output_type": "execute_result" | |
} | |
], | |
"source": [ | |
"survey[survey.Country == 'Lithuania'] \\\n", | |
" .LanguageDesireNextYear.str.split(';') \\\n", | |
" .apply(pd.Series, 1) \\\n", | |
" .unstack() \\\n", | |
" .reset_index(drop=True, level=0) \\\n", | |
" .dropna() \\\n", | |
" .value_counts()" | |
] | |
} | |
], | |
"metadata": { | |
"kernelspec": { | |
"display_name": "Python 3", | |
"language": "python", | |
"name": "python3" | |
}, | |
"language_info": { | |
"codemirror_mode": { | |
"name": "ipython", | |
"version": 3 | |
}, | |
"file_extension": ".py", | |
"mimetype": "text/x-python", | |
"name": "python", | |
"nbconvert_exporter": "python", | |
"pygments_lexer": "ipython3", | |
"version": "3.7.3" | |
} | |
}, | |
"nbformat": 4, | |
"nbformat_minor": 2 | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment