In [2]:
import pandas as pd
In [15]:
df = pd.read_csv('survey_results_public.csv')
df_schema = pd.read_csv('survey_results_schema.csv')
In [18]:
pd.set_option('display.max_columns',85)
In [19]:
df.head(5)
Out[19]:
Respondent MainBranch Hobbyist OpenSourcer OpenSource Employment Country Student EdLevel UndergradMajor EduOther OrgSize DevType YearsCode Age1stCode YearsCodePro CareerSat JobSat MgrIdiot MgrMoney MgrWant JobSeek LastHireDate LastInt FizzBuzz JobFactors ResumeUpdate CurrencySymbol CurrencyDesc CompTotal CompFreq ConvertedComp WorkWeekHrs WorkPlan WorkChallenge WorkRemote WorkLoc ImpSyn CodeRev CodeRevHrs UnitTests PurchaseHow PurchaseWhat LanguageWorkedWith LanguageDesireNextYear DatabaseWorkedWith DatabaseDesireNextYear PlatformWorkedWith PlatformDesireNextYear WebFrameWorkedWith WebFrameDesireNextYear MiscTechWorkedWith MiscTechDesireNextYear DevEnviron OpSys Containers BlockchainOrg BlockchainIs BetterLife ITperson OffOn SocialMedia Extraversion ScreenName SOVisit1st SOVisitFreq SOVisitTo SOFindAnswer SOTimeSaved SOHowMuchTime SOAccount SOPartFreq SOJobs EntTeams SOComm WelcomeChange SONewContent Age Gender Trans Sexuality Ethnicity Dependents SurveyLength SurveyEase
0 1 I am a student who is learning to code Yes Never The quality of OSS and closed source software ... Not employed, and not looking for work United Kingdom No Primary/elementary school NaN Taught yourself a new language, framework, or ... NaN NaN 4 10 NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN HTML/CSS;Java;JavaScript;Python C;C++;C#;Go;HTML/CSS;Java;JavaScript;Python;SQL SQLite MySQL MacOS;Windows Android;Arduino;Windows Django;Flask Flask;jQuery Node.js Node.js IntelliJ;Notepad++;PyCharm Windows I do not use containers NaN NaN Yes Fortunately, someone else has that title Yes Twitter Online Username 2017 A few times per month or weekly Find answers to specific questions;Learn how t... 3-5 times per week Stack Overflow was much faster 31-60 minutes No NaN No, I didn't know that Stack Overflow had a jo... No, and I don't know what those are Neutral Just as welcome now as I felt last year Tech articles written by other developers;Indu... 14.0 Man No Straight / Heterosexual NaN No Appropriate in length Neither easy nor difficult
1 2 I am a student who is learning to code No Less than once per year The quality of OSS and closed source software ... Not employed, but looking for work Bosnia and Herzegovina Yes, full-time Secondary school (e.g. American high school, G... NaN Taken an online course in programming or softw... NaN Developer, desktop or enterprise applications;... NaN 17 NaN NaN NaN NaN NaN NaN I am actively looking for a job I've never had a job NaN NaN Financial performance or funding status of the... Something else changed (education, award, medi... NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN C++;HTML/CSS;Python C++;HTML/CSS;JavaScript;SQL NaN MySQL Windows Windows Django Django NaN NaN Atom;PyCharm Windows I do not use containers NaN Useful across many domains and could change ma... Yes Yes Yes Instagram Online Username 2017 Daily or almost daily Find answers to specific questions;Learn how t... 3-5 times per week Stack Overflow was much faster 11-30 minutes Yes A few times per month or weekly No, I knew that Stack Overflow had a job board... No, and I don't know what those are Yes, somewhat Just as welcome now as I felt last year Tech articles written by other developers;Indu... 19.0 Man No Straight / Heterosexual NaN No Appropriate in length Neither easy nor difficult
2 3 I am not primarily a developer, but I write co... Yes Never The quality of OSS and closed source software ... Employed full-time Thailand No Bachelor’s degree (BA, BS, B.Eng., etc.) Web development or web design Taught yourself a new language, framework, or ... 100 to 499 employees Designer;Developer, back-end;Developer, front-... 3 22 1 Slightly satisfied Slightly satisfied Not at all confident Not sure Not sure I’m not actively looking, but I am open to new... 1-2 years ago Interview with people in peer roles No Languages, frameworks, and other technologies ... I was preparing for a job search THB Thai baht 23000.0 Monthly 8820.0 40.0 There's no schedule or spec; I work on what se... Distracting work environment;Inadequate access... Less than once per month / Never Home Average No NaN No, but I think we should Not sure I have little or no influence HTML/CSS Elixir;HTML/CSS PostgreSQL PostgreSQL NaN NaN NaN Other(s): NaN NaN Vim;Visual Studio Code Linux-based I do not use containers NaN NaN Yes Yes Yes Reddit In real life (in person) Username 2011 A few times per week Find answers to specific questions;Learn how t... 6-10 times per week They were about the same NaN Yes Less than once per month or monthly Yes No, I've heard of them, but I am not part of a... Neutral Just as welcome now as I felt last year Tech meetups or events in your area;Courses on... 28.0 Man No Straight / Heterosexual NaN Yes Appropriate in length Neither easy nor difficult
3 4 I am a developer by profession No Never The quality of OSS and closed source software ... Employed full-time United States No Bachelor’s degree (BA, BS, B.Eng., etc.) Computer science, computer engineering, or sof... Taken an online course in programming or softw... 100 to 499 employees Developer, full-stack 3 16 Less than 1 year Very satisfied Slightly satisfied Very confident No Not sure I am not interested in new job opportunities Less than a year ago Write code by hand (e.g., on a whiteboard);Int... No Languages, frameworks, and other technologies ... I was preparing for a job search USD United States dollar 61000.0 Yearly 61000.0 80.0 There's no schedule or spec; I work on what se... NaN Less than once per month / Never Home A little below average No NaN No, but I think we should Developers typically have the most influence o... I have little or no influence C;C++;C#;Python;SQL C;C#;JavaScript;SQL MySQL;SQLite MySQL;SQLite Linux;Windows Linux;Windows NaN NaN .NET .NET Eclipse;Vim;Visual Studio;Visual Studio Code Windows I do not use containers Not at all Useful for decentralized currency (i.e., Bitcoin) Yes SIGH Yes Reddit In real life (in person) Username 2014 Daily or almost daily Find answers to specific questions;Pass the ti... 1-2 times per week Stack Overflow was much faster 31-60 minutes Yes Less than once per month or monthly Yes No, and I don't know what those are No, not really Just as welcome now as I felt last year Tech articles written by other developers;Indu... 22.0 Man No Straight / Heterosexual White or of European descent No Appropriate in length Easy
4 5 I am a developer by profession Yes Once a month or more often OSS is, on average, of HIGHER quality than pro... Employed full-time Ukraine No Bachelor’s degree (BA, BS, B.Eng., etc.) Computer science, computer engineering, or sof... Taken an online course in programming or softw... 10,000 or more employees Academic researcher;Developer, desktop or ente... 16 14 9 Very dissatisfied Slightly dissatisfied Somewhat confident Yes No I am not interested in new job opportunities Less than a year ago Write any code;Write code by hand (e.g., on a ... No Industry that I'd be working in;Languages, fra... I was preparing for a job search UAH Ukrainian hryvnia NaN NaN NaN 55.0 There is a schedule and/or spec (made by me or... Being tasked with non-development work;Inadequ... A few days each month Office A little above average Yes, because I see value in code review NaN Yes, it's part of our process Not sure I have little or no influence C++;HTML/CSS;Java;JavaScript;Python;SQL;VBA HTML/CSS;Java;JavaScript;SQL;WebAssembly Couchbase;MongoDB;MySQL;Oracle;PostgreSQL;SQLite Couchbase;Firebase;MongoDB;MySQL;Oracle;Postgr... Android;Linux;MacOS;Slack;Windows Android;Docker;Kubernetes;Linux;Slack Django;Express;Flask;jQuery;React.js;Spring Flask;jQuery;React.js;Spring Cordova;Node.js Apache Spark;Hadoop;Node.js;React Native IntelliJ;Notepad++;Vim Linux-based Outside of work, for personal projects Not at all NaN Yes Also Yes Yes Facebook In real life (in person) Username I don't remember Multiple times per day Find answers to specific questions More than 10 times per week Stack Overflow was much faster NaN Yes A few times per month or weekly No, I knew that Stack Overflow had a job board... No, I've heard of them, but I am not part of a... Yes, definitely Just as welcome now as I felt last year Tech meetups or events in your area;Courses on... 30.0 Man No Straight / Heterosexual White or of European descent;Multiracial No Appropriate in length Easy
In [12]:
#setting index to Respondent
df =df.set_index('Respondent')
In [22]:
#salary column
df['ConvertedComp'].head(5)
Out[22]:
0        NaN
1        NaN
2     8820.0
3    61000.0
4        NaN
Name: ConvertedComp, dtype: float64
In [23]:
#median 
df['ConvertedComp'].median()
Out[23]:
57287.0
In [24]:
#look at all dataframe and return results where it finds numerical values
df.median()
Out[24]:
Respondent       44442.0
CompTotal        62000.0
ConvertedComp    57287.0
WorkWeekHrs         40.0
CodeRevHrs           4.0
Age                 29.0
dtype: float64
In [25]:
#returns bunch of aggregates from the df
df.describe()
Out[25]:
Respondent CompTotal ConvertedComp WorkWeekHrs CodeRevHrs Age
count 88883.000000 5.594500e+04 5.582300e+04 64503.000000 49790.000000 79210.000000
mean 44442.000000 5.519014e+11 1.271107e+05 42.127197 5.084308 30.336699
std 25658.456325 7.331926e+13 2.841523e+05 37.287610 5.513931 9.178390
min 1.000000 0.000000e+00 0.000000e+00 1.000000 0.000000 1.000000
25% 22221.500000 2.000000e+04 2.577750e+04 40.000000 2.000000 24.000000
50% 44442.000000 6.200000e+04 5.728700e+04 40.000000 4.000000 29.000000
75% 66662.500000 1.200000e+05 1.000000e+05 44.750000 6.000000 35.000000
max 88883.000000 1.000000e+16 2.000000e+06 4850.000000 99.000000 99.000000
In [26]:
#count returns count of non nan values
df['ConvertedComp'].count()
Out[26]:
55823
In [27]:
# value_counts returns the count of different types of results
df['Hobbyist'].value_counts()
Out[27]:
Yes    71257
No     17626
Name: Hobbyist, dtype: int64
In [29]:
df['SocialMedia']
Out[29]:
0          Twitter
1        Instagram
2           Reddit
3           Reddit
4         Facebook
           ...    
88878      YouTube
88879          NaN
88880          NaN
88881          NaN
88882     WhatsApp
Name: SocialMedia, Length: 88883, dtype: object
In [30]:
# Most popular socialMedia
df['SocialMedia'].value_counts()
Out[30]:
Reddit                      14374
YouTube                     13830
WhatsApp                    13347
Facebook                    13178
Twitter                     11398
Instagram                    6261
I don't use social media     5554
LinkedIn                     4501
WeChat 微信                     667
Snapchat                      628
VK ВКонта́кте                 603
Weibo 新浪微博                     56
Youku Tudou 优酷                 21
Hello                          19
Name: SocialMedia, dtype: int64
In [33]:
# Most popular socialMedia in percentage
df['SocialMedia'].value_counts(normalize=True)
Out[33]:
Reddit                      0.170233
YouTube                     0.163791
WhatsApp                    0.158071
Facebook                    0.156069
Twitter                     0.134988
Instagram                   0.074150
I don't use social media    0.065777
LinkedIn                    0.053306
WeChat 微信                   0.007899
Snapchat                    0.007437
VK ВКонта́кте               0.007141
Weibo 新浪微博                  0.000663
Youku Tudou 优酷              0.000249
Hello                       0.000225
Name: SocialMedia, dtype: float64
In [34]:
df['Country'].value_counts()
Out[34]:
United States                       20949
India                                9061
Germany                              5866
United Kingdom                       5737
Canada                               3395
                                    ...  
Tonga                                   1
Saint Vincent and the Grenadines        1
Saint Kitts and Nevis                   1
Dominica                                1
North Korea                             1
Name: Country, Length: 179, dtype: int64
In [35]:
df.groupby(['Country'])
Out[35]:
<pandas.core.groupby.generic.DataFrameGroupBy object at 0x139f2bd50>
In [36]:
country_grp = df.groupby(['Country'])
In [37]:
#returns data where country=India
country_grp.get_group('India')
Out[37]:
Respondent MainBranch Hobbyist OpenSourcer OpenSource Employment Country Student EdLevel UndergradMajor EduOther OrgSize DevType YearsCode Age1stCode YearsCodePro CareerSat JobSat MgrIdiot MgrMoney MgrWant JobSeek LastHireDate LastInt FizzBuzz JobFactors ResumeUpdate CurrencySymbol CurrencyDesc CompTotal CompFreq ConvertedComp WorkWeekHrs WorkPlan WorkChallenge WorkRemote WorkLoc ImpSyn CodeRev CodeRevHrs UnitTests PurchaseHow PurchaseWhat LanguageWorkedWith LanguageDesireNextYear DatabaseWorkedWith DatabaseDesireNextYear PlatformWorkedWith PlatformDesireNextYear WebFrameWorkedWith WebFrameDesireNextYear MiscTechWorkedWith MiscTechDesireNextYear DevEnviron OpSys Containers BlockchainOrg BlockchainIs BetterLife ITperson OffOn SocialMedia Extraversion ScreenName SOVisit1st SOVisitFreq SOVisitTo SOFindAnswer SOTimeSaved SOHowMuchTime SOAccount SOPartFreq SOJobs EntTeams SOComm WelcomeChange SONewContent Age Gender Trans Sexuality Ethnicity Dependents SurveyLength SurveyEase
7 8 I code primarily as a hobby Yes Less than once per year OSS is, on average, of HIGHER quality than pro... Not employed, but looking for work India NaN Bachelor’s degree (BA, BS, B.Eng., etc.) Computer science, computer engineering, or sof... Taught yourself a new language, framework, or ... NaN Developer, back-end;Engineer, site reliability 8 16 NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN Bash/Shell/PowerShell;C;C++;HTML/CSS;Java;Java... Bash/Shell/PowerShell;C;C++;Elixir;Erlang;Go;P... Cassandra;Elasticsearch;MongoDB;MySQL;Oracle;R... Cassandra;DynamoDB;Elasticsearch;Firebase;Mong... AWS;Docker;Heroku;Linux;MacOS;Slack Android;Arduino;AWS;Docker;Google Cloud Platfo... Express;Flask;React.js;Spring Django;Express;Flask;React.js;Vue.js Hadoop;Node.js;Pandas Ansible;Apache Spark;Chef;Hadoop;Node.js;Panda... Atom;IntelliJ;IPython / Jupyter;PyCharm;Visual... Linux-based Development;Testing;Production;Outside of work... NaN Useful across many domains and could change ma... Yes SIGH Yes YouTube In real life (in person) Handle 2012 A few times per week Find answers to specific questions;Learn how t... Less than once per week Stack Overflow was slightly faster 11-30 minutes Yes Less than once per month or monthly Yes No, and I don't know what those are Yes, definitely A lot more welcome now than last year Tech articles written by other developers;Indu... 24.0 Man No Straight / Heterosexual NaN NaN Appropriate in length Neither easy nor difficult
9 10 I am a developer by profession Yes Once a month or more often OSS is, on average, of HIGHER quality than pro... Employed full-time India No Master’s degree (MA, MS, M.Eng., MBA, etc.) NaN NaN 10,000 or more employees Data or business analyst;Data scientist or mac... 12 20 10 Slightly dissatisfied Slightly dissatisfied Somewhat confident Yes Yes I’m not actively looking, but I am open to new... 3-4 years ago NaN No Languages, frameworks, and other technologies ... NaN INR Indian rupee 950000.0 Yearly 13293.0 70.0 There's no schedule or spec; I work on what se... NaN A few days each month Home Far above average Yes, because I see value in code review 4.0 Yes, it's part of our process NaN NaN C#;Go;JavaScript;Python;R;SQL C#;Go;JavaScript;Kotlin;Python;R;SQL Elasticsearch;MongoDB;Microsoft SQL Server;MyS... Elasticsearch;MongoDB;Microsoft SQL Server Linux;Windows Android;Linux;Raspberry Pi;Windows Angular/Angular.js;ASP.NET;Django;Express;Flas... Angular/Angular.js;ASP.NET;Django;Express;Flas... .NET;Node.js;Pandas;Torch/PyTorch .NET;Node.js;TensorFlow;Torch/PyTorch Android Studio;Eclipse;IPython / Jupyter;Notep... Windows NaN Not at all Useful for immutable record keeping outside of... No Yes Yes YouTube Neither Screen Name NaN Multiple times per day Find answers to specific questions;Get a sense... 3-5 times per week They were about the same NaN Yes A few times per month or weekly Yes No, and I don't know what those are Yes, somewhat Somewhat less welcome now than last year Tech articles written by other developers;Tech... NaN NaN NaN NaN NaN Yes Too long Difficult
14 15 I am a student who is learning to code Yes Never OSS is, on average, of HIGHER quality than pro... Not employed, but looking for work India Yes, full-time Secondary school (e.g. American high school, G... NaN Taken an online course in programming or softw... NaN Student 3 13 NaN NaN NaN NaN NaN NaN I’m not actively looking, but I am open to new... I've never had a job NaN NaN Industry that I'd be working in;Languages, fra... Something else changed (education, award, medi... NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN Assembly;Bash/Shell/PowerShell;C;C++;HTML/CSS;... Assembly;Bash/Shell/PowerShell;C;C++;C#;Go;HTM... MariaDB;MySQL;Oracle;SQLite MariaDB;MongoDB;Microsoft SQL Server;MySQL;Ora... Linux;Windows Android;Google Cloud Platform;iOS;Linux;MacOS;... NaN Angular/Angular.js;ASP.NET;Django;Drupal;jQuer... NaN .NET;.NET Core;Node.js;TensorFlow;Unity 3D;Unr... Atom;NetBeans;Notepad++;Sublime Text;Vim Linux-based Development NaN NaN Yes Yes What? YouTube In real life (in person) NaN 2018 Daily or almost daily Find answers to specific questions;Learn how t... More than 10 times per week They were about the same NaN Yes Less than once per month or monthly Yes No, I've heard of them, but I am not part of a... Yes, somewhat Just as welcome now as I felt last year Tech articles written by other developers;Indu... 20.0 Man No NaN NaN Yes Too long Neither easy nor difficult
49 50 I am a developer by profession Yes Once a month or more often OSS is, on average, of LOWER quality than prop... Employed full-time India No Bachelor’s degree (BA, BS, B.Eng., etc.) Another engineering discipline (ex. civil, ele... Received on-the-job training in software devel... 10,000 or more employees Developer, back-end;DevOps specialist 7 15 2 Slightly satisfied Very satisfied Very confident Not sure Yes I’m not actively looking, but I am open to new... 1-2 years ago Write code by hand (e.g., on a whiteboard);Int... No Specific department or team I'd be working on;... I was preparing for a job search INR Indian rupee 400000.0 Yearly 5597.0 7.0 There is a schedule and/or spec (made by me or... Meetings;Time spent commuting Less than once per month / Never Other place, such as a coworking space or cafe Average No NaN Yes, it's not part of our process but the deve... The CTO, CIO, or other management purchase new... I have little or no influence Bash/Shell/PowerShell;C;C++;HTML/CSS;Java;Java... HTML/CSS;JavaScript;Python Elasticsearch;Firebase;MariaDB;MongoDB;MySQL;O... Firebase;PostgreSQL;Redis;Other(s): Arduino;AWS;Heroku;Linux;MacOS;Raspberry Pi;Wo... AWS;Docker;Heroku;Kubernetes;Linux;MacOS;WordP... Django;Express;Flask;jQuery Express;Flask;jQuery;React.js;Vue.js Node.js Node.js Notepad++;Visual Studio Code MacOS Testing Not at all Useful for immutable record keeping outside of... Yes Also Yes What? YouTube In real life (in person) Username 2012 Daily or almost daily Find answers to specific questions;Learn how t... 3-5 times per week Stack Overflow was slightly faster 11-30 minutes Yes Less than once per month or monthly No, I knew that Stack Overflow had a job board... No, and I don't know what those are Yes, definitely Just as welcome now as I felt last year Tech articles written by other developers;Tech... 23.0 Man No NaN South Asian No Too long Easy
64 65 I am a developer by profession Yes Never NaN Employed full-time India No Bachelor’s degree (BA, BS, B.Eng., etc.) Information systems, information technology, o... NaN 20 to 99 employees Developer, front-end;Developer, mobile 2 17 2 Very satisfied Very satisfied Very confident No Not sure I’m not actively looking, but I am open to new... Less than a year ago Write any code;Solve a brain-teaser style puzz... No Languages, frameworks, and other technologies ... My job status changed (promotion, new job, etc.) INR Indian rupee NaN Monthly NaN 48.0 There's no schedule or spec; I work on what se... NaN About half the time Office Average Yes, because I see value in code review NaN Yes, it's not part of our process but the deve... Not sure NaN Assembly;C;C++;C#;HTML/CSS;Java Kotlin Firebase;MySQL;Oracle;SQLite Firebase;SQLite Android Android ASP.NET NaN NaN NaN Android Studio;IntelliJ Linux-based NaN NaN NaN Yes Yes What? WhatsApp In real life (in person) NaN 2017 Multiple times per day Find answers to specific questions More than 10 times per week Stack Overflow was slightly faster 11-30 minutes Yes A few times per week No, I knew that Stack Overflow had a job board... No, and I don't know what those are Not sure A lot more welcome now than last year NaN 21.0 Man No NaN NaN Yes Appropriate in length Neither easy nor difficult
... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ...
88808 77339 NaN Yes Less than once per year OSS is, on average, of HIGHER quality than pro... Employed full-time India Yes, full-time Bachelor’s degree (BA, BS, B.Eng., etc.) Another engineering discipline (ex. civil, ele... Taken an online course in programming or softw... 1,000 to 4,999 employees NaN 1 27 1 NaN NaN Somewhat confident Yes Yes NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN Other(s): Python;SQL NaN NaN NaN NaN NaN NaN NaN NaN NaN Linux-based I do not use containers NaN NaN Yes Yes No YouTube Online UserID 2019 Less than once per month or monthly Find answers to specific questions;Learn how t... 1-2 times per week Stack Overflow was much faster 31-60 minutes Yes I have never participated in Q&A on Stack Over... No, I didn't know that Stack Overflow had a jo... No, I've heard of them, but I am not part of a... Yes, somewhat Not applicable - I did not use Stack Overflow ... Tech articles written by other developers;Indu... NaN NaN NaN NaN NaN NaN NaN NaN
88825 79795 NaN Yes Less than once a month but more than once per ... OSS is, on average, of HIGHER quality than pro... Employed full-time India No Bachelor’s degree (BA, BS, B.Eng., etc.) Computer science, computer engineering, or sof... Taken an online course in programming or softw... 500 to 999 employees Developer, QA or test 6 17 5 NaN NaN Somewhat confident No Not sure NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN Bash/Shell/PowerShell;Python;SQL;VBA NaN NaN NaN NaN NaN NaN NaN Apache Spark;Chef;Puppet NaN PyCharm;Vim Linux-based Development;Testing;Production;Outside of work... Not at all NaN No Yes What? Instagram In real life (in person) Username 2018 A few times per month or weekly Find answers to specific questions Less than once per week They were about the same NaN Yes I have never participated in Q&A on Stack Over... No, I didn't know that Stack Overflow had a jo... No, and I don't know what those are Neutral Somewhat more welcome now than last year Tech meetups or events in your area;Courses on... NaN Man No Straight / Heterosexual NaN No Too long Difficult
88852 83862 NaN Yes Once a month or more often OSS is, on average, of HIGHER quality than pro... Employed full-time India Yes, full-time Bachelor’s degree (BA, BS, B.Eng., etc.) NaN Participated in a hackathon NaN Data or business analyst;Student 1 18 Less than 1 year NaN NaN Very confident Not sure Yes NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN Assembly;C;C++;HTML/CSS;Java;JavaScript;Object... NaN MySQL DynamoDB;Elasticsearch;MongoDB Android;AWS;Google Cloud Platform;WordPress IBM Cloud or Watson Laravel Angular/Angular.js;Laravel;Vue.js NaN Node.js Android Studio;Atom;IntelliJ;Komodo;NetBeans;N... Windows I do not use containers NaN Useful across many domains and could change ma... No Yes What? Twitter Online UserID 2012 A few times per month or weekly Find answers to specific questions;Learn how t... Less than once per week Stack Overflow was much faster 0-10 minutes Yes I have never participated in Q&A on Stack Over... Yes No, and I don't know what those are Yes, definitely Just as welcome now as I felt last year Tech articles written by other developers;Indu... 24.0 Man No Straight / Heterosexual NaN Yes Too long Neither easy nor difficult
88853 84299 NaN Yes Never The quality of OSS and closed source software ... Employed full-time India Yes, full-time Bachelor’s degree (BA, BS, B.Eng., etc.) Web development or web design Taken an online course in programming or softw... 100 to 499 employees Developer, back-end;Developer, front-end;Devel... 12 25 12 NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN HTML/CSS;Java;JavaScript;Python;Swift;TypeScript HTML/CSS;Java;JavaScript MongoDB;Redis;SQLite MongoDB;Redis NaN NaN Angular/Angular.js;Express;jQuery;React.js;Oth... Express;React.js;Other(s): Node.js Node.js IntelliJ;Notepad++;Visual Studio Code;Xcode Windows NaN NaN NaN Yes Fortunately, someone else has that title What? LinkedIn NaN NaN 2011 A few times per month or weekly Find answers to specific questions;Contribute ... Less than once per week Stack Overflow was much faster 60+ minutes Yes Less than once per month or monthly Yes No, and I don't know what those are Yes, somewhat Somewhat more welcome now than last year NaN NaN NaN NaN NaN NaN NaN NaN NaN
88864 86012 NaN Yes Once a month or more often OSS is, on average, of HIGHER quality than pro... Employed full-time India No Master’s degree (MA, MS, M.Eng., MBA, etc.) Another engineering discipline (ex. civil, ele... Taught yourself a new language, framework, or ... 100 to 499 employees Academic researcher;Educator 5 15 NaN NaN NaN Somewhat confident No Not sure NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN Bash/Shell/PowerShell;C++;HTML/CSS;JavaScript C++;Python MySQL NaN Other(s): Other(s): NaN NaN NaN NaN Notepad++ Linux-based I do not use containers NaN NaN No Also Yes What? I don't use social media Online Username 2014 A few times per month or weekly Find answers to specific questions Less than once per week Stack Overflow was much faster 11-30 minutes Yes NaN No, I knew that Stack Overflow had a job board... Yes Yes, somewhat Not applicable - I did not use Stack Overflow ... Industry news about technologies you're intere... 24.0 Man No NaN South Asian NaN Appropriate in length Easy

9061 rows × 85 columns

In [41]:
#same as above using filter
filt= (df['Country'] =='India')
df.loc[filt]
Out[41]:
Respondent MainBranch Hobbyist OpenSourcer OpenSource Employment Country Student EdLevel UndergradMajor EduOther OrgSize DevType YearsCode Age1stCode YearsCodePro CareerSat JobSat MgrIdiot MgrMoney MgrWant JobSeek LastHireDate LastInt FizzBuzz JobFactors ResumeUpdate CurrencySymbol CurrencyDesc CompTotal CompFreq ConvertedComp WorkWeekHrs WorkPlan WorkChallenge WorkRemote WorkLoc ImpSyn CodeRev CodeRevHrs UnitTests PurchaseHow PurchaseWhat LanguageWorkedWith LanguageDesireNextYear DatabaseWorkedWith DatabaseDesireNextYear PlatformWorkedWith PlatformDesireNextYear WebFrameWorkedWith WebFrameDesireNextYear MiscTechWorkedWith MiscTechDesireNextYear DevEnviron OpSys Containers BlockchainOrg BlockchainIs BetterLife ITperson OffOn SocialMedia Extraversion ScreenName SOVisit1st SOVisitFreq SOVisitTo SOFindAnswer SOTimeSaved SOHowMuchTime SOAccount SOPartFreq SOJobs EntTeams SOComm WelcomeChange SONewContent Age Gender Trans Sexuality Ethnicity Dependents SurveyLength SurveyEase
7 8 I code primarily as a hobby Yes Less than once per year OSS is, on average, of HIGHER quality than pro... Not employed, but looking for work India NaN Bachelor’s degree (BA, BS, B.Eng., etc.) Computer science, computer engineering, or sof... Taught yourself a new language, framework, or ... NaN Developer, back-end;Engineer, site reliability 8 16 NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN Bash/Shell/PowerShell;C;C++;HTML/CSS;Java;Java... Bash/Shell/PowerShell;C;C++;Elixir;Erlang;Go;P... Cassandra;Elasticsearch;MongoDB;MySQL;Oracle;R... Cassandra;DynamoDB;Elasticsearch;Firebase;Mong... AWS;Docker;Heroku;Linux;MacOS;Slack Android;Arduino;AWS;Docker;Google Cloud Platfo... Express;Flask;React.js;Spring Django;Express;Flask;React.js;Vue.js Hadoop;Node.js;Pandas Ansible;Apache Spark;Chef;Hadoop;Node.js;Panda... Atom;IntelliJ;IPython / Jupyter;PyCharm;Visual... Linux-based Development;Testing;Production;Outside of work... NaN Useful across many domains and could change ma... Yes SIGH Yes YouTube In real life (in person) Handle 2012 A few times per week Find answers to specific questions;Learn how t... Less than once per week Stack Overflow was slightly faster 11-30 minutes Yes Less than once per month or monthly Yes No, and I don't know what those are Yes, definitely A lot more welcome now than last year Tech articles written by other developers;Indu... 24.0 Man No Straight / Heterosexual NaN NaN Appropriate in length Neither easy nor difficult
9 10 I am a developer by profession Yes Once a month or more often OSS is, on average, of HIGHER quality than pro... Employed full-time India No Master’s degree (MA, MS, M.Eng., MBA, etc.) NaN NaN 10,000 or more employees Data or business analyst;Data scientist or mac... 12 20 10 Slightly dissatisfied Slightly dissatisfied Somewhat confident Yes Yes I’m not actively looking, but I am open to new... 3-4 years ago NaN No Languages, frameworks, and other technologies ... NaN INR Indian rupee 950000.0 Yearly 13293.0 70.0 There's no schedule or spec; I work on what se... NaN A few days each month Home Far above average Yes, because I see value in code review 4.0 Yes, it's part of our process NaN NaN C#;Go;JavaScript;Python;R;SQL C#;Go;JavaScript;Kotlin;Python;R;SQL Elasticsearch;MongoDB;Microsoft SQL Server;MyS... Elasticsearch;MongoDB;Microsoft SQL Server Linux;Windows Android;Linux;Raspberry Pi;Windows Angular/Angular.js;ASP.NET;Django;Express;Flas... Angular/Angular.js;ASP.NET;Django;Express;Flas... .NET;Node.js;Pandas;Torch/PyTorch .NET;Node.js;TensorFlow;Torch/PyTorch Android Studio;Eclipse;IPython / Jupyter;Notep... Windows NaN Not at all Useful for immutable record keeping outside of... No Yes Yes YouTube Neither Screen Name NaN Multiple times per day Find answers to specific questions;Get a sense... 3-5 times per week They were about the same NaN Yes A few times per month or weekly Yes No, and I don't know what those are Yes, somewhat Somewhat less welcome now than last year Tech articles written by other developers;Tech... NaN NaN NaN NaN NaN Yes Too long Difficult
14 15 I am a student who is learning to code Yes Never OSS is, on average, of HIGHER quality than pro... Not employed, but looking for work India Yes, full-time Secondary school (e.g. American high school, G... NaN Taken an online course in programming or softw... NaN Student 3 13 NaN NaN NaN NaN NaN NaN I’m not actively looking, but I am open to new... I've never had a job NaN NaN Industry that I'd be working in;Languages, fra... Something else changed (education, award, medi... NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN Assembly;Bash/Shell/PowerShell;C;C++;HTML/CSS;... Assembly;Bash/Shell/PowerShell;C;C++;C#;Go;HTM... MariaDB;MySQL;Oracle;SQLite MariaDB;MongoDB;Microsoft SQL Server;MySQL;Ora... Linux;Windows Android;Google Cloud Platform;iOS;Linux;MacOS;... NaN Angular/Angular.js;ASP.NET;Django;Drupal;jQuer... NaN .NET;.NET Core;Node.js;TensorFlow;Unity 3D;Unr... Atom;NetBeans;Notepad++;Sublime Text;Vim Linux-based Development NaN NaN Yes Yes What? YouTube In real life (in person) NaN 2018 Daily or almost daily Find answers to specific questions;Learn how t... More than 10 times per week They were about the same NaN Yes Less than once per month or monthly Yes No, I've heard of them, but I am not part of a... Yes, somewhat Just as welcome now as I felt last year Tech articles written by other developers;Indu... 20.0 Man No NaN NaN Yes Too long Neither easy nor difficult
49 50 I am a developer by profession Yes Once a month or more often OSS is, on average, of LOWER quality than prop... Employed full-time India No Bachelor’s degree (BA, BS, B.Eng., etc.) Another engineering discipline (ex. civil, ele... Received on-the-job training in software devel... 10,000 or more employees Developer, back-end;DevOps specialist 7 15 2 Slightly satisfied Very satisfied Very confident Not sure Yes I’m not actively looking, but I am open to new... 1-2 years ago Write code by hand (e.g., on a whiteboard);Int... No Specific department or team I'd be working on;... I was preparing for a job search INR Indian rupee 400000.0 Yearly 5597.0 7.0 There is a schedule and/or spec (made by me or... Meetings;Time spent commuting Less than once per month / Never Other place, such as a coworking space or cafe Average No NaN Yes, it's not part of our process but the deve... The CTO, CIO, or other management purchase new... I have little or no influence Bash/Shell/PowerShell;C;C++;HTML/CSS;Java;Java... HTML/CSS;JavaScript;Python Elasticsearch;Firebase;MariaDB;MongoDB;MySQL;O... Firebase;PostgreSQL;Redis;Other(s): Arduino;AWS;Heroku;Linux;MacOS;Raspberry Pi;Wo... AWS;Docker;Heroku;Kubernetes;Linux;MacOS;WordP... Django;Express;Flask;jQuery Express;Flask;jQuery;React.js;Vue.js Node.js Node.js Notepad++;Visual Studio Code MacOS Testing Not at all Useful for immutable record keeping outside of... Yes Also Yes What? YouTube In real life (in person) Username 2012 Daily or almost daily Find answers to specific questions;Learn how t... 3-5 times per week Stack Overflow was slightly faster 11-30 minutes Yes Less than once per month or monthly No, I knew that Stack Overflow had a job board... No, and I don't know what those are Yes, definitely Just as welcome now as I felt last year Tech articles written by other developers;Tech... 23.0 Man No NaN South Asian No Too long Easy
64 65 I am a developer by profession Yes Never NaN Employed full-time India No Bachelor’s degree (BA, BS, B.Eng., etc.) Information systems, information technology, o... NaN 20 to 99 employees Developer, front-end;Developer, mobile 2 17 2 Very satisfied Very satisfied Very confident No Not sure I’m not actively looking, but I am open to new... Less than a year ago Write any code;Solve a brain-teaser style puzz... No Languages, frameworks, and other technologies ... My job status changed (promotion, new job, etc.) INR Indian rupee NaN Monthly NaN 48.0 There's no schedule or spec; I work on what se... NaN About half the time Office Average Yes, because I see value in code review NaN Yes, it's not part of our process but the deve... Not sure NaN Assembly;C;C++;C#;HTML/CSS;Java Kotlin Firebase;MySQL;Oracle;SQLite Firebase;SQLite Android Android ASP.NET NaN NaN NaN Android Studio;IntelliJ Linux-based NaN NaN NaN Yes Yes What? WhatsApp In real life (in person) NaN 2017 Multiple times per day Find answers to specific questions More than 10 times per week Stack Overflow was slightly faster 11-30 minutes Yes A few times per week No, I knew that Stack Overflow had a job board... No, and I don't know what those are Not sure A lot more welcome now than last year NaN 21.0 Man No NaN NaN Yes Appropriate in length Neither easy nor difficult
... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ...
88808 77339 NaN Yes Less than once per year OSS is, on average, of HIGHER quality than pro... Employed full-time India Yes, full-time Bachelor’s degree (BA, BS, B.Eng., etc.) Another engineering discipline (ex. civil, ele... Taken an online course in programming or softw... 1,000 to 4,999 employees NaN 1 27 1 NaN NaN Somewhat confident Yes Yes NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN Other(s): Python;SQL NaN NaN NaN NaN NaN NaN NaN NaN NaN Linux-based I do not use containers NaN NaN Yes Yes No YouTube Online UserID 2019 Less than once per month or monthly Find answers to specific questions;Learn how t... 1-2 times per week Stack Overflow was much faster 31-60 minutes Yes I have never participated in Q&A on Stack Over... No, I didn't know that Stack Overflow had a jo... No, I've heard of them, but I am not part of a... Yes, somewhat Not applicable - I did not use Stack Overflow ... Tech articles written by other developers;Indu... NaN NaN NaN NaN NaN NaN NaN NaN
88825 79795 NaN Yes Less than once a month but more than once per ... OSS is, on average, of HIGHER quality than pro... Employed full-time India No Bachelor’s degree (BA, BS, B.Eng., etc.) Computer science, computer engineering, or sof... Taken an online course in programming or softw... 500 to 999 employees Developer, QA or test 6 17 5 NaN NaN Somewhat confident No Not sure NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN Bash/Shell/PowerShell;Python;SQL;VBA NaN NaN NaN NaN NaN NaN NaN Apache Spark;Chef;Puppet NaN PyCharm;Vim Linux-based Development;Testing;Production;Outside of work... Not at all NaN No Yes What? Instagram In real life (in person) Username 2018 A few times per month or weekly Find answers to specific questions Less than once per week They were about the same NaN Yes I have never participated in Q&A on Stack Over... No, I didn't know that Stack Overflow had a jo... No, and I don't know what those are Neutral Somewhat more welcome now than last year Tech meetups or events in your area;Courses on... NaN Man No Straight / Heterosexual NaN No Too long Difficult
88852 83862 NaN Yes Once a month or more often OSS is, on average, of HIGHER quality than pro... Employed full-time India Yes, full-time Bachelor’s degree (BA, BS, B.Eng., etc.) NaN Participated in a hackathon NaN Data or business analyst;Student 1 18 Less than 1 year NaN NaN Very confident Not sure Yes NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN Assembly;C;C++;HTML/CSS;Java;JavaScript;Object... NaN MySQL DynamoDB;Elasticsearch;MongoDB Android;AWS;Google Cloud Platform;WordPress IBM Cloud or Watson Laravel Angular/Angular.js;Laravel;Vue.js NaN Node.js Android Studio;Atom;IntelliJ;Komodo;NetBeans;N... Windows I do not use containers NaN Useful across many domains and could change ma... No Yes What? Twitter Online UserID 2012 A few times per month or weekly Find answers to specific questions;Learn how t... Less than once per week Stack Overflow was much faster 0-10 minutes Yes I have never participated in Q&A on Stack Over... Yes No, and I don't know what those are Yes, definitely Just as welcome now as I felt last year Tech articles written by other developers;Indu... 24.0 Man No Straight / Heterosexual NaN Yes Too long Neither easy nor difficult
88853 84299 NaN Yes Never The quality of OSS and closed source software ... Employed full-time India Yes, full-time Bachelor’s degree (BA, BS, B.Eng., etc.) Web development or web design Taken an online course in programming or softw... 100 to 499 employees Developer, back-end;Developer, front-end;Devel... 12 25 12 NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN HTML/CSS;Java;JavaScript;Python;Swift;TypeScript HTML/CSS;Java;JavaScript MongoDB;Redis;SQLite MongoDB;Redis NaN NaN Angular/Angular.js;Express;jQuery;React.js;Oth... Express;React.js;Other(s): Node.js Node.js IntelliJ;Notepad++;Visual Studio Code;Xcode Windows NaN NaN NaN Yes Fortunately, someone else has that title What? LinkedIn NaN NaN 2011 A few times per month or weekly Find answers to specific questions;Contribute ... Less than once per week Stack Overflow was much faster 60+ minutes Yes Less than once per month or monthly Yes No, and I don't know what those are Yes, somewhat Somewhat more welcome now than last year NaN NaN NaN NaN NaN NaN NaN NaN NaN
88864 86012 NaN Yes Once a month or more often OSS is, on average, of HIGHER quality than pro... Employed full-time India No Master’s degree (MA, MS, M.Eng., MBA, etc.) Another engineering discipline (ex. civil, ele... Taught yourself a new language, framework, or ... 100 to 499 employees Academic researcher;Educator 5 15 NaN NaN NaN Somewhat confident No Not sure NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN Bash/Shell/PowerShell;C++;HTML/CSS;JavaScript C++;Python MySQL NaN Other(s): Other(s): NaN NaN NaN NaN Notepad++ Linux-based I do not use containers NaN NaN No Also Yes What? I don't use social media Online Username 2014 A few times per month or weekly Find answers to specific questions Less than once per week Stack Overflow was much faster 11-30 minutes Yes NaN No, I knew that Stack Overflow had a job board... Yes Yes, somewhat Not applicable - I did not use Stack Overflow ... Industry news about technologies you're intere... 24.0 Man No NaN South Asian NaN Appropriate in length Easy

9061 rows × 85 columns

In [42]:
#social media count in india
filt= (df['Country'] =='India')
df.loc[filt]['SocialMedia'].value_counts()
Out[42]:
WhatsApp                    2990
YouTube                     1820
LinkedIn                     955
Facebook                     841
Instagram                    822
Twitter                      542
Reddit                       473
I don't use social media     250
Snapchat                      23
WeChat 微信                      5
Hello                          5
VK ВКонта́кте                  4
Youku Tudou 优酷                 2
Weibo 新浪微博                     1
Name: SocialMedia, dtype: int64
In [43]:
#this will return social media for every country
country_grp['SocialMedia'].value_counts()
Out[43]:
Country      SocialMedia             
Afghanistan  Facebook                    15
             YouTube                      9
             I don't use social media     6
             WhatsApp                     4
             Instagram                    1
                                         ..
Zimbabwe     Facebook                     3
             YouTube                      3
             Instagram                    2
             LinkedIn                     2
             Reddit                       1
Name: SocialMedia, Length: 1220, dtype: int64
In [45]:
country_grp['SocialMedia'].value_counts(normalize=True).loc['India']
Out[45]:
SocialMedia
WhatsApp                    0.342379
YouTube                     0.208405
LinkedIn                    0.109355
Facebook                    0.096301
Instagram                   0.094126
Twitter                     0.062063
Reddit                      0.054162
I don't use social media    0.028627
Snapchat                    0.002634
Hello                       0.000573
WeChat 微信                   0.000573
VK ВКонта́кте               0.000458
Youku Tudou 优酷              0.000229
Weibo 新浪微博                  0.000115
Name: SocialMedia, dtype: float64
In [47]:
#median salary in India
country_grp['ConvertedComp'].median().loc['India']
Out[47]:
10080.0
In [48]:
#returning multiple aggregate functions
country_grp['ConvertedComp'].agg(['median','mean']).loc['India']
Out[48]:
median    10080.000000
mean      28057.664916
Name: India, dtype: float64
In [56]:
#how many people know python in india using filter
filt= (df['Country'] =='India')
df.loc[filt]['LanguageWorkedWith'].str.contains('Python').sum()
Out[56]:
3105
In [52]:
#how many people know python in india using group_by
country_grp['LanguageWorkedWith'].str.contains('Python').sum()
#you need to use apply method with group_by aggregate function
---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-52-deb69932b683> in <module>
      1 #how many people know python in india using group_by
----> 2 country_grp['LanguageWorkedWith'].str.contains('Python').sum()

~/anaconda3/lib/python3.7/site-packages/pandas/core/groupby/groupby.py in __getattr__(self, attr)
    561             return self[attr]
    562         if hasattr(self.obj, attr):
--> 563             return self._make_wrapper(attr)
    564 
    565         raise AttributeError(

~/anaconda3/lib/python3.7/site-packages/pandas/core/groupby/groupby.py in _make_wrapper(self, name)
    602                 "using the 'apply' method".format(kind, name, type(self).__name__)
    603             )
--> 604             raise AttributeError(msg)
    605 
    606         self._set_group_selection()

AttributeError: Cannot access attribute 'str' of 'SeriesGroupBy' objects, try using the 'apply' method
In [61]:
#how many people know python in india using group_by
country_grp['LanguageWorkedWith'].apply(lambda x: x.str.contains('Python').sum()).loc['India']
Out[61]:
3105
In [74]:
# Q % of python users in each country
country_uses_python = country_grp['LanguageWorkedWith'].apply(lambda x: x.str.contains('Python').sum())
country_uses_python
Out[74]:
Country
Afghanistan                              8
Albania                                 23
Algeria                                 40
Andorra                                  0
Angola                                   2
                                        ..
Venezuela, Bolivarian Republic of...    28
Viet Nam                                78
Yemen                                    3
Zambia                                   4
Zimbabwe                                14
Name: LanguageWorkedWith, Length: 179, dtype: int64
In [79]:
country_respondants = df['Country'].value_counts()
country_respondants
Out[79]:
United States                       20949
India                                9061
Germany                              5866
United Kingdom                       5737
Canada                               3395
                                    ...  
Tonga                                   1
Saint Vincent and the Grenadines        1
Saint Kitts and Nevis                   1
Dominica                                1
North Korea                             1
Name: Country, Length: 179, dtype: int64
In [81]:
python_df = pd.concat([country_respondants,country_uses_python],axis='columns', sort=False)
python_df
Out[81]:
Country LanguageWorkedWith
United States 20949 10083
India 9061 3105
Germany 5866 2451
United Kingdom 5737 2384
Canada 3395 1558
... ... ...
Tonga 1 0
Saint Vincent and the Grenadines 1 0
Saint Kitts and Nevis 1 0
Dominica 1 1
North Korea 1 0

179 rows × 2 columns

In [83]:
#renaming columns 
python_df.rename(columns={'Country': 'NumRespondents', 'LanguageWorkedWith': 'NumKnowsPython'}, inplace=True)
In [84]:
python_df
Out[84]:
NumRespondents NumKnowsPython
United States 20949 10083
India 9061 3105
Germany 5866 2451
United Kingdom 5737 2384
Canada 3395 1558
... ... ...
Tonga 1 0
Saint Vincent and the Grenadines 1 0
Saint Kitts and Nevis 1 0
Dominica 1 1
North Korea 1 0

179 rows × 2 columns

In [85]:
# % of python users in each country
python_df['PctKnowsPython'] = python_df['NumKnowsPython']/python_df['NumRespondents'] * 100
In [87]:
python_df.sort_values(by='PctKnowsPython', ascending=False)
Out[87]:
NumRespondents NumKnowsPython PctKnowsPython
Timor-Leste 1 1 100.000000
Dominica 1 1 100.000000
Sao Tome and Principe 1 1 100.000000
Niger 1 1 100.000000
Turkmenistan 7 6 85.714286
... ... ... ...
Liberia 2 0 0.000000
Gabon 2 0 0.000000
Burkina Faso 4 0 0.000000
Cape Verde 3 0 0.000000
North Korea 1 0 0.000000

179 rows × 3 columns

In [88]:
# % of python users in india
python_df.loc['India']
Out[88]:
NumRespondents    9061.000000
NumKnowsPython    3105.000000
PctKnowsPython      34.267741
Name: India, dtype: float64