(String: {%- set hs_blog_post_body -%} {%- set in_blog_post_body = true -%} <span id="hs_cos_wrapper_post_body" class="hs_cos_wrapper hs_cos_wrapper_meta_field hs_cos_wrapper_type_rich_text" style="" data-hs-cos-general-type="meta_field" data-hs-cos-type="rich_text"> <div class="blog-post__lead h2"> <p style="font-weight: bold;">For many years, R has been the obvious choice for those going into data science.</p> </div></span>)

How Did Python Become the Language of Choice for Data Science?

Photo of Krzysztof Basel

Krzysztof Basel

Updated Jun 16, 2023 • 8 min read
tomasz-frankowski-198764-unsplash-383053-edited

For many years, R has been the obvious choice for those going into data science.

In recent years, something’s changed, however, and R got dethroned. How is Python challenging R’s well-established position and why is Python the king of data science now?

Python has a lot to offer, so an increasing number of people are adopting this programming language for their work. In Google Trends, Python is well ahead of R. Python is a good choice for all kinds of data science projects, but it is the most popular in the financial sector. We’ll mention only one example here: The Bank of America has picked Python as their tool of choice for crunching financial data.

Python vs R data science tendency

You can see the original chart here.

Less is more

“Simple is better than complex”, wrote Tim Peters in “The Zen of Python”, a collection of 20 software principles that influenced the design of the Python Programming Language. Python is well known for making programs work with the least lines of code possible. It automatically identifies and associates data types and follows an indentation based nesting structure. Overall, the language is easy to use, and it takes less time to code a solution in Python. Some people call Python ”The Swiss Army Knife Of Coding”. Python is versatile and easy, however, R is specialised tool, which is designed specifically for data analysis.

One language for everything

As a general purpose programming language, Python is universal. It’s a quick, but powerful tool with plenty of capabilities. Python gives you an opportunity to build your machine learning models, web applications, and anything else you need in one language. This will simplify your project, and save you time and money.

fabian-blank-78637-unsplash

The Python community is growing

Python has a great number of scientific computing libraries provided by the huge community around it. Have a quick look at PyPi, a repository of software for Python, and explore the full extent of what is being developed within the Python community. NumPy is a great example here –– it’s the core library for scientific computing in Python, established in 2006. Recently, NumPy raised a $645,000 grant, which will support its development.


Another good example is SciPy. This library can be used for optimization, linear algebra, integration, interpolation, special functions, FFT, signal and image processing, ODE solvers, and other tasks popular in science and engineering. SciPy builds on the NumPy array object and is part of the NumPy stack, which includes tools such as Matplotlib, pandas, and SymPy, and an expanding set of scientific computing libraries.

Python has a great number of data science/machine learning libraries

Need more libraries for Python? This popular programing language has a great number of free data science, machine learning, and data analysis libraries such as Pandas or Scikit-Learn. Pandas provides fast, flexible, and expressive data structures designed to make working with “relational” or “labeled” data easy and intuitive. It’s one of the most powerful and flexible open-source data analysis tools available.

There are a lot of deep learning frameworks in Python

There are plenty of deep learning frameworks, such as Caffe, TensorFlow, PyTorch, Keras, or mxnet. You can pick from many free tools, which will fit your project, allowing you to build deep learning architectures with remarkably few lines of Python code.

Python is a great choice for writing scraping software

Python offers a great variety of tools for scraping data. It’s true that many languages have some libraries that can help in web scraping, but again, Python has the largest community support for doing so. You can choose many different scraping ecosystems, such as Scrapy, BeautifulSoup, or requests. Scrapy, for instance, is more then just a library – it is a great framework designed specifically for scraping the web. It can handle a lot of the dirty work for you, by providing a structure for your spiders. By using Scrapy, you will be able to write web spiders in minutes.

Need to process tons of data? Use Python

If you need to process tons of data you can go with PySpark or Hadoop. There’s also MPI binding for distributed processing, if Spark’s overhead is too much for your specific case.


If you use Spark, some engineers recommend developing solutions in Scala, which is the “native” language of Spark. For many, Python is even a better option, because of complete PySpark API.

max-nelson-492729-unsplash-2

“(…)like many developers, I love Python because it’s flexible, robust, easy to learn, and benefits from all my favorite libraries. In my opinion, Python is the perfect language for prototyping in Big Data/Machine Learning fields”, said Charles Bochet CTO @LuckeyHomes.

Python has code readability as one of its fundamental assumptions

“There should be one—and preferably only one—obvious way to do it” is another quotation for “The Zen of Python”, mentioned at the beginning of this article. As you can see, code readability is one of the most important design principles of Python. Several different programmers may write different programs in Python, but the ideal is that the code will not only be similar but also easy to understand and read. Python code is highly readable, some programmers even say that it looks almost like the English language. Why is it important? It helps to revisit your code to fix a bug or add a feature months after the product has been launched. What’s more, it can also be done by others with ease.

Python too slow? There is Cython

Some might argue that Python is slower than some other programming languages. When you read “Python Pros and Cons: What are The Benefits and Downsides of the Programming Language”, you will find out that speed isn’t Python strong suit. But there is a solution that can boost the language’s speed. It’s Cython, a superset of the Python programming language designed to achieve C-like performance with code that is written mostly in Python. It makes writing C extensions for Python as easy as writing in Python itself. Cython combines the ease of Python with the speed of native code. It can give you a few percent to several orders of magnitude gains in speed.

The wrap up

No need to look for more comparisons between Python and R. Python is really a pleasure to work with. It’s a powerful and versatile language that allows you to do more with less code. You can use many different frameworks for free that can help you to process tons of data, write scraping software, or build deep learning architectures with just a few lines of code. It’s great for building digital products based on machine learning. You can incorporate it into your own workflow alongside the tools you already use. To sum up, why not try adding Python to your project?

Photo of Krzysztof Basel

More posts by this author

Krzysztof Basel

We're Netguru!

At Netguru we specialize in designing, building, shipping and scaling beautiful, usable products with blazing-fast efficiency
Let's talk business!

Trusted by: