R vs. Python: Analysis Based on Data from Stack Overflow
Contributed by Chuan Hong. Chuan is currently in the NYC Data Science Academy 12 week full-time Data Science Bootcamp program taking place between September 26th to December 23rd, 2016. This post is based on her class project - R Β Shiny.
Motivation
Both R and Python are widely used programming languages for data analysis ranging from basic statistics and visualization to complex model analysis. I am curious about "which is more popular: R or Python?". Thus, I created anΒ app to visualize the popularity of R versus Python based on data from Stack Overflow over the past six years.
Data Source and Processing
Data were from kaggle, R Questions from Stack OverflowΒ and Python Questions from Stack Overflow. Stack Overflow is the largest online community for programmers to learn, share their knowledge, and advance their career. The table below shows the raw data from kaggle. The data of R or Python was organized in three tables: Questions, Answers, and Tags.Β Full text of questions and answers from Stack Overflow that are tagged with the "Tags", useful for natural language processing and community analysis.
Next, since we only cared about the number of questions and answers for each language, we nailed down to the following variables in each table.
In order to separate the "Tags" into "packages" and "topics", I also scraped a list of R packages from CRAN Packages By Name, and a list of Python packages from PyPI Ranking as well.
Β Visualizations
-
Summary of R & Python
First, let's look at the aggregatedΒ number of users and the number of questions/answers. The bar chart below shows that more users posted questions/answers related to Python than users posting about R. Similarly, the total number of questions/answers of Python is greater than that of R.
-
Time Trend: R vs. Python
The video below shows how to check the time trend of R or Python with different items. For example, we can see how the number of users posting questions and the number of questions of Β R or Python changed from 1/15/2000 to 9/15/2016. Obviously, both of R and Python was increasing during the past six years, and the number of users asking questions about Python (n=9441) is greater than thatΒ about R (n=2612).
-
Topics: Β R versus Python
Next, let's look at the findings about packages and topics. The most popular topics of R are dataframe, plot, loops, regex, and function.
Based on the graph below, we can see the most popular topics of Python areΒ python 2.7, python 3.x, list, dictionary, and tkinter.