Change language

Python vs. R: what should a beginner Data Scientist choose?

| |

Python and R have long been the standard for Data Science. The essence of their confrontation is that both languages are perfectly suited to work with statistics. While Python is characterized by its clear syntax and large number of libraries, the R language was developed specifically for statisticians, and is therefore equipped with high-quality data visualization. SQL stands apart - because if the data is already in the tables, it's more luck than good luck - and Scala, mostly because it's the basis for Spark, the most popular distributed processing framework.

To do initial data analysis and decide on the fate of a feature, you need only SQL and command line tools, because data science is not about libraries with bright names - it is about approach. However, this kind of minimalism has its limits (and can even scare a beginner away), and at some point you will have to resort to more advanced research tools.

In this article we, together with SkillFactory, have analyzed for you the advantages and disadvantages of R and Python as the first languages in a data scientist's career. Developers looking to add a useful skill line to their resume will also be interested.

Python for Data Science

Quite imperceptibly, Python's thirtieth birthday has crept up. During its long history Python has been reborn several times losing backward compatibility, but it has always been popular among developers in general and data scientists in particular. There are several reasons for this.

Benefits of Python in Data Science

  • Simple but expressive syntax. Knowledge of English at the level of first grade school - it's already a victory, because the basics of Python can be considered mastered. It won't be much harder from here on out. If you already know, for example, Java, you will be pleasantly surprised how easy it is to say "hello" to the world.
  • Rich choice of libraries. And we are not just talking about machine learning algorithm libraries - Python is used for developing cloud storage, streaming services, and even games (although they sometimes have to play with brakes as a chip, not a bug).
  • High documentation culture. Python itself is beautifully documented, and usually libraries in it continue this tradition.

For all its greatness, Python is not without its downsides. It's often (and sometimes justifiably) described as slow, it still lacks an easy-to-use ORM facility, and it's hard work and discipline to write a real large project in it. But as with any tool, it's important to just know how to use it. Speaking of tools.

Python tools for the data scientist

As mentioned earlier, Python is notable for its extensive set of libraries and tools. Speaking of data science, the following should be mentioned first:

  • Pandas is a data manipulation library with enormous capabilities. It allows very fast research of new data, testing of hypotheses, getting a report. One of the main advantages of Python.
  • Scikit-learn - large library of machine learning and data processing algorithms. A large part of the Kaggle competition has been won using it alone, paired with Pandas.
  • Keras and PyTorch - libraries used for training deep neural networks. Suitable for tasks related to images, audio and video files.
  • IPython Notebook - When talking about Python it's impossible not to mention it. The standard development environment is not quite suitable for data scientist in the process of researching data. There is a need for a format that allows you, for example, to run a costly algorithm, and when it finishes, you can play with the results for a while, examine them and build graphs. That's where the notebook format comes in. It is a graphical interface that opens in a normal browser and is a sequence of cells where you can write and execute code while using shared memory to store data.

R for Data Science

In 2020, R remains one of the most popular languages for Data Science and statistics, steadily gaining an increasing share of views in the corresponding sections of StackOverflow. At the same time, academic questions are leading by a significant margin: first of all, R is a language with a rich set of libraries for machine learning and statistics, which is especially important for research purposes.

Benefits of R in Data Science

  • Rich ML ecosystem, huge number of statistical method libraries. As noted earlier, R is particularly popular in academia, which leads to new methods often being implemented on it for the first time.
  • Pretty convenient proprietary RStudio development environment, which will be easy to deal with if you've had MATLAB experience.
  • Unusual syntax, tailored to the needs of statistics. Experienced programmers with knowledge of another language can have some trouble acclimatizing, but users with mathematical background will easily grasp the logic of the language.
  • Native support for vector calculations. A cool bonus, which means that you can program fairly fast implementations of mathematical methods using vector and matrix calculations in R.

R tools for the data scientist

Let's talk about the mentioned library riches of R. Here are some of the basic but powerful libraries, armed with which you can do extensive riserch or take good seats in Kaggle:

  • Dplyr, a "data manipulation grammar" library with similar functionality to Pandas.
  • Ggplot2 and Esquisse are powerful libraries for graph drawing.
  • Shiny - the most useful library for creating web-applications with interactive research visualization.
  • Caret, randomForest, Mlr, etc. - dozens of libraries with machine learning techniques. One of them will definitely work.

Python vs. R in Data Science: which is better?

Both languages have their advantages and disadvantages. Either one can work, it all depends on your objectives. Here are some points that may help with the choice:

  • Have you already programmed in other languages? If so, it may take some time to get used to R. Python is much more familiar, except for some nuances.
  • Do you plan to work in academia, or are you leaning toward being closer to practice? Python is closer to production and is used more often in commercial projects. At the same time, R is more popular in academia.
  • Do you want to expand your horizons in machine learning methods? Or will it be enough to familiarize yourself with several most popular methods and devote more time to algorithms of big data processing, for example? In the first case you definitely need R, in the second - you'll find more opportunities in Python.
  • Do you want to do your own development implementation, and program anything other than predictors? If yes, then Python is the best fit for you, but you probably need something else (like Java, Scala or C++) as well.

Shop

Learn programming in R: courses

$

Best Python online courses for 2022

$

Best laptop for Fortnite

$

Best laptop for Excel

$

Best laptop for Solidworks

$

Best laptop for Roblox

$

Best computer for crypto mining

$

Best laptop for Sims 4

$

Latest questions

NUMPYNUMPY

psycopg2: insert multiple rows with one query

12 answers

NUMPYNUMPY

How to convert Nonetype to int or string?

12 answers

NUMPYNUMPY

How to specify multiple return types using type-hints

12 answers

NUMPYNUMPY

Javascript Error: IPython is not defined in JupyterLab

12 answers

News


Wiki

Python OpenCV | cv2.putText () method

numpy.arctan2 () in Python

Python | os.path.realpath () method

Python OpenCV | cv2.circle () method

Python OpenCV cv2.cvtColor () method

Python - Move item to the end of the list

time.perf_counter () function in Python

Check if one list is a subset of another in Python

Python os.path.join () method