Pandas, Numpy, and Scikit-Learn are among the most popular libraries for data science and analysis with Python. In this Python cheat sheet for data science, we’ll summarize some of the most common and useful functionality from these libraries.

Numpy is used for lower level scientific computation. Pandas is built on top of Numpy and designed for practical data analysis in Python. Scikit-Learn comes with many machine learning models that you can use out of the box.

Importing Data 

Any kind of data analysis starts with getting hold of some data. Pandas gives you plenty of options for getting data into your Python workbook:

Exploring Data 

Once you have imported your data into a Pandas dataframe, you can use these methods to get a sense of what the data looks like:

Selecting

Often, you might need to select a single element or a certain subset of the data to inspect it or perform further analysis. These methods will come in handy:

Data Cleaning

If you’re working with real world data, chances are you’ll need to clean it up. These are some helpful methods:

Filter, Sort and Group By

Methods for filtering, sorting and grouping your data:

Joining and Combining

Methods for combining two dataframes:

Writing Data

And finally, when you have produced results with your analysis, there are several ways you can export your data:

Machine Learning

The Scikit-Learn library contains useful methods for training and applying machine learning models. Our Scikit-Learn tutorial provides more context for the code below.

For a complete list of the Supervised Learning, Unsupervised Learning, and Dataset Transformation, and Model Evaluation modules in Scikit-Learn, please refer to its user guide.

Conclusion

We’ve barely scratching the surface in terms of what you can do with Python and data science, but we hope this Python cheat sheet for data science has given you a taste of what you can do!

This post was kindly provided by our friend Kara Tan. Kara is a cofounder of Altitude Labs, a full-service app design and development agency that specializes in data driven design and personalization.

Additional Resources: