5 Reasons to Use Python for Data Science
Updated November 2019
Last year in 2018 we wrote this article debating the merits of using Python for data science. At that time, the debate between the merits of using R and other languages vs. Python for data science was still open to discussion. In just a year, it seems that Python is winning, or even has won. If you’re a budding Data Scientist with no programming background, or a business person who needs to dabble in data science, learning to code can be a daunting prospect. It seems that now, learning Python for data science is the best route. Here’s 5 reasons why.
What Programming Language is Most Useful for Data Science?
Many in the data science field have long predicted that Python will become the most popular language for Data Scientists and Data Engineers.
The use of Python for data science applications has been gaining steam in recent years. As the figure to the right shows, recent research from data science recruitment firms Burtch Works confirms Python’s spot as the number one language over R and SAS.
In addition, our own research speaking to universities about their data science degree programs confirms that they are choosing across the board to implement Python for data science curriculum at the undergraduate level.
Finally the majority of QuntHub customers want to test Python skills for data science roles, and especially data engineering roles.
Python is first and foremost a general-purpose programming language. It was not specifically designed with data science and analytics in mind. Yet it is proving to be the most useful language for data science for the foresseable future. Why?
In this article, we offer our top 5 reasons to use Python for data science. They were valid in 2018 when we wrote this article, and they are still valid today.
Just to mix it up, at the end we’ve addressed the one or two minor caveats that you might hear about the shortcomings of Python for data science.
1. Ten Year Old’s Can Learn Python
Really, it’s that easy.
Ever heard of Raspberry Pi? If you are not the most confident beginning coder, start with Python.
You’ll be coding in no time (well OK, maybe not in no time – it is data science after all – but faster than with R or Java for sure!).
Python is simple, easy to learn, and guarantees a much quicker learning curve than any other language. A standard “hello world” in Python 3.x is nothing more than: print(“Hello world!”).
As this example shows, Python is famous for making programs work using the fewest lines of code. This simplicity is a huge advantage for companies wanting to develop junior Data Scientists and Data Analysts, or to train domain experts and physicists to be Data Scientists.
The ease of learning Python enables Data Scientists to be productive on data science projects within a relatively short amount of time. Here’s a perfect example of how easy it is to get going: 6 Deep Learning Applications a beginner can build in minutes (using Python).
As someone learning Python for data science, you can also take advantage of the various online resources. This includes dozens of “Python for data science” online tutorials and a multitude of learning communities and resources in the ever-expanding Python ecosystem.
If you get stuck in your learning and problem solving, no worries. The nice folks in the Python support communities will be happy to help solve your issues no matter how basic.
Given the demand for Data Scientists out there, we think it makes sense for anyone getting into the field to choose a language that will get them up and running so quickly.
Barry Warsaw, a member of the Python Foundation team at LinkedIn, said,
“…one thing that Python has as a language, and I think this is its real strength, is that it scales along with the human scale.”
It’s true that with Python, one person can write up a script on their laptop or 10-15 people can collaborate on a project. Hundreds, even thousands of people working on a complex project can all use Python.
Python is by far more scalable than any other language used for data science or otherwise. It is so scalable that even YouTube migrated to Python.
Python also has the built-in flexibility to solve just about any kind of problem. It can be used for many different purposes.
Python is particularly helpful when data analysis tasks must be integrated with web apps and cloud computing platforms, or when they are part of a bigger project that involves many complexities.
For example, the compatibility of Python with Hadoop, the most important open-source big data platform, is yet another reason to prefer it over other languages.
Other aspects of Python which make it scalable for data science is that it runs on just about every operating system and platform, allows for modules written in C and C++ to be extended using Python, and interfaces with most major libraries and API powered services.
Python is in effect a great single technology to manage an entire data-related workflow.
3. Python’s Data Science Libraries are Solid
Python’s libraries for data science have mushroomed in recent years further increasing its popularity and usefulness for analytics.
This growth gives confidence to the fact that while Python’s data science libraries may still have a way to go versus “R”, any remaining constraints are minor and will likely be overcome soon by dedicated volunteers in its ecosystem.
Don’t let the cute names fool you – NumPy, Pandas, SciPy, Scikit-Learn, etc. – Python’s data science libraries are powerful and very broad, now covering just about any math function.
• Numpy is great for linear algebra, high-level mathematical functions, and random number crunching.
• Pandas – not the kind that eats bamboo – provides a range of functions for handling data structures and operations such as manipulating tables and time series.
• SciPy is useful for common data science tasks like linear algebra, interpolation, and signal processing.
Others include SymPy for symbolic algebra and Statsmodel for statistical modelling.
Still, other libraries such as Cython convert code so it can run in a C environment.
• PyMySQL serves to connect a MySQL database, extract data and execute queries.
• BeautifulSoup serves as an all-in-one toolbox for scraping XML and HTML and extracting data from it.
One very popular library, Scikit-learn, brings us to our next reason for using Python for data science.
4. Python Shines in Machine Learning and Algorithms
Stack Overflow reported recently reported that “Growth in Python use has been fastest among data scientists, and particularly those working in machine learning.”
Harnham Recruiters 2019 US Data and Analytics Salary Guide also concluded that “There has also been a sharp rise in demand for Python-based deep learning experience, so familiarity with tools like TensorFlow, Caffe and Torch is increasingly more attractive to hiring managers.”
Python thus appears to be winning out over R in terms of machine learning work, language unity, and linked data structures, as was confirmed too by a post comparing Python and R from a professor of computer science at the University of California, Davis.
Machine learning is best and most easily supported using Python. Python as a programming language makes “doing the math” – probabilities, statistics, optimizations – easy, thus, highly useful for implementing algorithms.
So much so that Google built Tensorflow, it’s machine learning library for research in deep neural networks, using Python.
Python’s Scikit-learn package is a machine learning library that is useful for classification, regression, and clustering algorithms. This includes random forests and gradient boosting.
PyBrain library offers powerful algorithms for machine learning tasks and the ability to test and compare algorithms.
The combination of these specialized machine learning libraries makes Python uniquely suited to developing sophisticated models and prediction engines that can interface directly with a business system.
New machine learning libraries are being developed continuously and will no doubt give cause to using Python for data science.
5. Python’s Data Visualization Has Caught Up to “R”
“R” has always been considered to be the best programming language for data visualization.
However, as is typically the case with Python, several solid solutions for data visualization have been developed recently.
Python’s foundational Matplotlib 2D plotting library offers strong publication quality graphic and visualization options such as histograms, power spectra and scatterplots, and with minimal coding.
For over a year now, TabPy has existed to integrate with Tableau allowing for some pretty powerful advanced analytics when combined with Python’s machine learning capabilities.
Python’s achievements on this last Data Visualization frontier, versus “R”, are fueling its growth.
There’s No App for That
So, what is Python NOT good for? The short answer is not much.
But if we had to pick one thing it is not good at, you can’t really make a mobile app using Python. So there’s that.
The Python for Data Science Bottom Line
The bottom line is that Python is a very popular language for data science for all of these good reasons and more.
It’s versatile, dynamic, and actually pretty easy to learn. Yet it’s a language that is robust enough to solve problems in math, statistics and more.
And because of its very large fan base, Data Scientists will more likely find some people in non-technical departments such as Marketing or Finance who have a working knowledge of Python, thus making it somewhat easier to communicate and collaborate.
Overall Python tends to be a win-win for businesses and their data science teams.
Now that you know why Python is advantageous in data science, consider evaluating data scientist candidates and your employees based on their Python skills.
Knowing Python by itself certainly isn’t the end-all-be-all skill for Data Scientists, but finding someone with great Python skills for data exploration, machine learning, etc. could be.
Are you an R fanboy/fangirl? Do you still love the commercial products like SAS? Leave a comment below and make your case!