Subscribe to DSC Newsletter

The Guide to Learning Python for Data Science

Guest blog post by Martijn Theuwissen, co-founder at DataCamp.Other Python resources can be found here

Python is widely used for data analysis and you might have considered learning it yourself (if not, or if you’re still looking for that bit of extra motivation to get started, see why you should be learning Python below). Of course, learning on your own can be a challenge and some guidance is always helpful. Guidance to learn Python for working with data is exactly what this article will provide you with.

We will discuss steps you should take for learning Python accompanied with some essential resources, such as the free Python for Data Analysis courses and tutorials from DataCamp as well as reading and learning materials.

Step 0: Reasons to Learn Python

Why learn Python as a data analytics tool?

  • It’s a Popular Data Analysis Tool: Firstly, by itself Python is one of the most popular tools for data analysis. With 35% of data scientists using Python, it is ahead of SQL and SAS, and behind only R.
  • General Purpose Programming: Despite there being other very popular and great computing tools used for analyzing data (e.g. R, SAS), Python is the only true general purpose programming language. Check out this infographic for a more thorough comparison.
  • Popular Programming Language: In addition, Python is one the most popular programming languages, when compared with other general purpose languages (e.g. Java, C++, PHP).
  • If that’s not enough, Python is also the language of choice for teaching computer science in top U.S. universities.

As a side note: we don’t recommend that you only learn Python and forget about the rest. However, learning Python is one of the best things you can do for your career. There are good reasons why Python is being adopted so widely by computer scientists, and why it’s a data analysis tool of choice for so many, the main one being the ease of learning and using Python. Nonetheless, it can be challenging to set a learning path, so that’s what we will do now.

Step 1: Setting up your Python Environment for Data Analysis

  • Download Python from Continuum Analytics: ANACONDA
  • Optional (Download Rodeo from Yhat): Rodeo IDE

Setting up your Python environment for performing data analysis is relatively simple. The most convenient way to go about this is to download the free Anaconda package from Continuum Analytics, as it contains the core Python language, as well as all of the essential libraries including NumPy, Pandas, SciPy, Matplotlib, and IPython. By using the graphical installer, downloading Python is as easy as downloading any computer program.

After installing, you will get a launcher containing a number of programs. The most important one is the iPython notebook, which is also called Jupyter notebook. Once  you launch the notebook, the terminal is opened and a notebook is opened in your browser. Don’t get confused here! You don’t need internet connection to create or use the notebooks. Simply, the browser is used instead of a separate program and serves as your environment,where you can code.

However, you are not limited to using the browser based Jupyter notebooks. If you prefer an IDE, a great option for data analysis is Rodeo from Yhat. If you are familiar with RStudio for R, Rodeo is something very similar for Python. Be sure to try out both alternatives, as, ultimately, the Python environment you use will depend on your personal preference.

Step 2: Learning the Basics and Fundamentals

Now you are ready to begin learning to code with Python. There are a couple of good ways to go about this. Given your interest to learn Python for data analysis, your best option is the Introduction for Python for Data Science from DataCamp. This free course consist of video tutorials and interactive in browser exercises and is a great way to learn by doing, as opposed to simply reading concepts and looking at examples. You wouldn’t begin learning how to paint by reading a book about it. You would pick up a brush and start painting. That’s the way we would suggest for you to start learning Python! In addition to the introductory course, DataCamp offers an Intermediate Python for Data Science course which takes you even further.

Another quite useful resource is the Python course from Codecademy. While this course is not about data, but rather programming with Python, it is a great way to both practice with Python syntax and gain exposure to programming concepts that will be useful to you when working with data.

Step 3: Python Packages for Data Analysis

Python is a general purpose language and is often used for things other than data analysis and data science. What makes Python extremely useful for working with data, however, are the libraries that give users the necessary functionality. Below are the major Python libraries that are used for working with data. You should take some time to familiarize yourself with the basic purposes of these packages.

  • Numpy and Scipy – fundamental scientific computing.
  • Pandas – data manipulation and analysis.
  • Matplotlib – plotting and visualization.
  • Scikit-learn – machine learning and data mining.
  • StatsModels – statistical modeling, testing, and analysis.

Step 4: Get Data to Learn With. (Loading Data)

The best way to learn and get comfortable with Python, or any other new programming language, is to take a sample dataset to work with, experiment, and try the new skills and techniques you pick up along the way.

The StatsModels library contains some preloaded datasets that you could use. Otherwise you can load a data set from the web or a csv file. To do so you can follow a sample code from available examples or forums like Stack overflow.  Always have your dataset available and treat it as a toy that you can play with and learn from.

Step 5: Manipulating Data

One of the most hands-on skills of working with data is data manipulation. Data doesn’t always come clean and analysis-ready. In order to be able to analyse data, we often need data that is manipulated through transformations, formatting, cleaning, etc. Pandas and Numpy are the go to tools for that in Python, so start learning how to use them with your sample dataset.

Step 6: Visualizing Data

Another essential skill in data analysis is data . Visuals are extremely important for both exploratory data analysis, as well the communication of your results. Matplotlib is the most commonly used library for this in Python.

Step 7: Data Analytics

Of course analyzing data is not just about formatting and making plots and graphs. The analytics begins with statistical modeling, machine learning algorithms, data mining techniques, inferences and so on. Python is a fantastic tool for analyzing data because it has libraries such as Scikit-learn and StatsModels which contain the implementations of the models and algorithms that you might need for your analysis. Of course, as Python is a general purpose programming language, you are also free to program your own methods when you become an advanced user, though make sure you are not replicating what already exists.

  • Begin by considering a familiar technique that you will be able to follow (e.g.. Linear RegressionK-nearest neighborsTime Series) and find an example of implementation in Python.
  • Try performing a simple analysis on your toy dataset.
  • You can look at examples of Scikit-learn and StatsModels methods that you might not know, just to appreciate the possibilities.

Step 8: Reporting

Communicating your analysis is a key soft skill in data science. Of course, communication begins with good use of language and style. However, an equally important aspect of communicating your analysis is preparing legible reports. Luckily you have a handy tool for that in the form of the previously mentioned Jupyter Notebooks (see step 1).

While you can use the Jupyter Notebooks as a place to code and do your analysis, you can also imbed text, formatted formulas, even images and video if you like. What’s more, you have to options of exporting your code in various formats that include PDFs, HTML, and Markdown.

Step 9: Mastering Python

After learning the basics of Python and exploring the main tools and libraries with your sample dataset, you should proceed to taking some courses either for Python, or courses taught with Python to begin mastering the language. Apparently, after 10,000 hours you can become an expert in anything, so don’t wait and get started! Some online course and sources for projects we would recommend include:

DSC Resources

Additional Reading

Follow us on Twitter: @DataScienceCtrl | @AnalyticBridge

Views: 28151


You need to be a member of Data Science Central to add comments!

Join Data Science Central

Comment by Dr S Kotrappa on February 16, 2017 at 5:59am

very nice article for Python enthusiasts like me thank you  Martijn Theuwissen

Comment by Victoria Alieva on June 11, 2016 at 10:38am

Thanks a lot!

Comment by Piter Leal on May 6, 2016 at 12:31pm

cool. thanks for the guidance.

i bookmarked this guide ... it's easy to get lost in midst of so much information . I took a python course from coursera. it was best online class - most useful . i just need to find an interesting project to continue the learning process .

i have python installed via cygwin ... I did a few scrypting projects for the coursera couse (web page scraping ) .

I will use this post to follow up on the learning.  thank you.

next step : install Anaconda

Follow Us


  • Add Videos
  • View All


© 2017   Data Science Central   Powered by

Badges  |  Report an Issue  |  Privacy Policy  |  Terms of Service