Practical Business Python

Taking care of business, one python script at a time

Mon 02 February 2015

Generating Excel Reports from a Pandas Pivot Table

Posted by Chris Moffitt in articles   

The previous pivot table article described how to use the pandas pivot_table function to combine and present data in an easy to view manner. This concept is probably familiar to anyone that has used pivot tables in Excel. However, pandas has the capability to easily take a cross section of the data and manipulate it. This cross section capability makes a pandas pivot table really useful for generating custom reports. This article will give a short example of how to manipulate the data in a pivot table to create a custom Excel report with a subset of pivot table data.

Read more...


Mon 29 December 2014

Pandas Pivot Table Explained

Posted by Chris Moffitt in articles   

Most people likely have experience with pivot tables in Excel. Pandas provides a similar function called (appropriately enough) pivot_table. While it is exceedingly useful, I frequently find myself struggling to remember how to use the syntax to format the output for my needs. This article will focus on explaining the pandas pivot_table function and how to use it for your data analysis.

Read more...


Wed 17 December 2014

Combining Data From Multiple Excel Files

Posted by Chris Moffitt in articles   

A very common tasks for python and pandas is to automate the process of aggregating data from multiple files and spreadsheets.

This article will walk through the basic flow required to parse multiple Excel files, combine the data, clean it up and analyze it. The combination of python + pandas can be extremely powerful for these activities and can be a very useful alternative to the manual processes or painful VBA scripts frequently used in business settings today.

Read more...


Mon 08 December 2014

Common Excel Tasks Demonstrated in Pandas - Part 2

Posted by Chris Moffitt in articles   

I have been very excited by the response to the first post in this series. Thank you to all for the positive feedback. I want to keep the series going by highlighting some other tasks that you commonly execute in Excel and show how you can perform similar functions in pandas.

In the first article, I focused on common math tasks in Excel and their pandas counterparts. In this article, I’ll focus on some common selection and filtering tasks and illustrate how to do the same thing in pandas.

Read more...