Blog
Friends of data

Chris Moffitt

An interview with the author of Practical Business Python

cm-headshot-2021-1

Chris Moffitt is the creator and primary author of Practical Business Python, a popular site dedicated to using Python to solve real-world problems with data.

I interviewed him about how he got into Python, barriers for learning, and what excites him about the future of code literacy. This interview has been condensed and edited for clarity.


Barry: how did you first get interested in working with data and Python?

Chris: I studied computer science and electrical engineering in college, so that was the foundation. It was mostly C, C++, and a little bit of Pascal, so I had that baseline knowledge of how to program. Then, I graduated and went into the Navy. It really wasn't a job where I had to program, but I did find myself doing some system administration, and that led to wanting to script some things and I learned Perl to do it behind the scenes.

I decided to get out of the Navy and to make that transition, and there's a lot of unknowns. How do you move from military to civilian world? I took a job with a medical device company doing a Unix administration, and then my next role was on the Windows world. And when I moved to Windows, I really missed having all the scripting capabilities. We used WinBatch and VBScript, and then someone mentioned to me, "Hey, there's this programming language called Python. It's pretty cool. You should check it out." I looked at it, and I thought "ah, I don't know about this whole white space thing. It doesn't sound like it would really work."

I found myself more in business settings where most people around me, the only thing they knew was Excel, and maybe some VBA. And that's when I started to spend more time with Python, figuring out how I could use that Python data science ecosystem to manipulate the data and build tools either for the group or for my own analysis. I really liked it and things clicked.

What sets Python apart as a language for you?

First, Python kind of fits in your head and it is relatively easy to understand how to do what you want to do. You don't have the braces and there's not as much punctuation; some people say it's kind of like pseudo code and you can kind of read Python and understand.

The next barrier is, even if you can get it running on your system and figured out how to do something, how do you share it with someone else? That is the single biggest problem.

The thing that really sold me though is that when I learned C++, we talked about object oriented programming, but I never really understood it. Once I started using Python, it clicked, and a lot of things that were hard for me to really grasp in C or C++ really made a lot more sense in Python.

And then what has kept me is how broadly useful Python is. I don't feel like there's much of a ceiling with Python. I know enough that if I really had to do something on the web, Python could do it pretty well. If I need to do something data-sciencey, Python can do it. If I need to move files around or work with PDFs, there's something out there in the Python ecosystem that I can use. I think that's what has really kept me there. I understand Python is not perfect, there's plenty of areas for improvement but it's just that breadth of areas that you can use Python is really what has kept me around.

What inspired you to start Practical Business Python?

I had a side gig where I did some Django development. Part of the reason for doing that was my wife was starting a business, and she wanted to have a storefront on the web. And I looked around like any good geek would do to see what's out there. What can I set up? And at the time the leading platform was OScommerce, which was PHP based.

I got it working, but really disliked working with PHP and it just felt ugly. And then once I started learning Django, I started to build an e‑commerce platform with it and really enjoyed it. I did that for several years, but then that all kind of fizzled, and I didn't work on Python for a little bit.

At one point I thought I'd like to get back into it, and I thought, maybe I'll start a blog and that'll be an opportunity for me to get that going again and share some of the knowledge. At the time, my original idea was that I was going to focus more on Raspberry PI. There's probably a lot of cool things you could do. I thought it would be fun to write a blog about it. And then somewhere along the line, I learned about Pandas, and then that's when I realized, that all the stuff that I've been doing in Excel that was hard to get into Python, Pandas really opened that up. Once I started working with Pandas it was starting to get into the whole data science ecosystem, that's when I was like, "Oh yeah, this is what I want to focus on". As I was learning, I was trying to document as much of it as I could.

Who do feel like you're writing for, and hear the most feedback from?

The primary people that I write for, and the ones that I hear from the most, are the people that are in business or academia and are somewhat technical. They could be engineers, or in finance, or accounting. And they realize there's a better way to do things instead of Excel. And so they think, "Oh, there's this Python thing. How could I use it to solve my problems?" They're the ones that find my blog and that's who I write for.

I'm trying to give specific examples to people. It's not so much about the syntax or libraries, it's more "the art of the possible". I'm not on the bleeding edge of deep learning or something like that, which I think is interesting, but more like, someone that has hundreds of Excel files and they're pulling their hair out with this process and it feels like there has to be a better way.

What are the biggest barriers to adoption that you hear your readers running into?

There is typically some organizational resistance if you want to install and use Python. I may not know how to install Python or, the organization won't let them, because they think it's a security risk. That is a very real problem that some people have, although there has been progress especially on Windows platform with Python being more of a first‑class citizen, so maybe that's going away.

The next barrier is, even if you can get it running on your system and figured out how to do something, how do you share it with someone else? That is the single biggest problem. Some people approach this the wrong way. There are certainly purists that think, "all this stuff should be pure programming. We don't need Excel, rip it out and do it all in Python." I don't think that's going to be the case. I think Excel stays around; your CFO is not going to say I don't need Excel. I think it's more important to focus on specific problems where Python could be the right solution, but it's a big challenge to bring in more people. If you're that lone Crusader, and you develop something really cool, how do you get 10 other people using what you built?

The power of Python is the ecosystem and all the libraries that are out there, but how do you manage that? When you're starting to share solutions with people, and telling them, "you've got to have this version of pandas and numpy and scikit-learn. How do you get everybody up to the same, setting or the same environment so that they can all use it?

You're touching on some really classic problems. How do you see these things changing over the next few years? Would you imagine most people are doing some work in SQL or Python? Or is that still a smaller group? Would you imagine most things are still happening in Excel?

It's hard to say. As much as I would like to see more people using Python, Excel is so entrenched that it's going to be around for the foreseeable future.

What is interesting though, is it does feel like the notebook paradigm is expanding to have more graphical capabilities, so you can view a full data frame and do some sorting and searching, which is easier to do graphically. There's a cool library called DTale. It gives you like a graphical interface of your dataframe. And you can sort the data and do some things, but what's interesting is it shows the actual Pandas code. So you can go back and forth between a graphical view and syntax. That's very cool.

They are spending so much time trying to manage this Excel monstrosity. And they just intuitively understand, "computers are supposed to help us". And it feels like there has to be a better way.

Excel feels like it's getting more and more complicated and more and more real programmer paradigms are burgeoning in Excel. Microsoft just came out with these new Lambda formulas, and data types. It feels like Excel is building some alternative programming environment that's not VBScript. And then the Python world is developing more GUI-type approaches. So it seems like there's going to be growth in the middle where you get the best of both worlds.

What are some of the biggest motivators you see pushing people out into Python from spreadsheets?

People get to this point in Excel and suddenly there is a formula, or a full worksheet that is so complicated. They realize, "I don't understand this and I can't maintain it." It's brutal to maintain, but it's critical to the business. It's not just an academic exercise – their business runs on this process, and they are spending so much time trying to manage this Excel monstrosity. They intuitively understand, "computers are supposed to help us" and it feels like there has to be a better way.

There are people that are a curious. Maybe they have some programming background or were more technical or at least have that interest and maybe aptitude to go there. And they're the ones that start to say, okay, this process is broken. There has to be something better.

Do you think most of the folks now that are coming into this space are learning Python earlier, like in school?

I get a lot of questions on my blog where people are earlier in their career, or in university, and they're just trying to learn how to do something. Maybe they have learned Python in school, or they're learning it on their own and they're trying to solve a problem. My son is a freshman mechanical engineer. I was just talking to him the other day and he was saying, "hey, I've got an opportunity to participate in some research projects." But every single one of them was a machine learning project. Each project was about, "how do I use machine learning or AI in this mechanical engineering space using Python?" So there's the future of more people coming through where they at least have that exposure to Python and they have a baseline familiarity.

I also hear from people that are further in their career, and have some domain expertise and technical interest and are now trying to use Python to solve their problems. I have a case study on my blog that I did with a gentleman that runs an energy firm in Germany. He wanted a way to get temperature measurements from the German weather service so that he could build some models to predict energy usage. He used some of the examples on Practical Business Python to figure out how to download, extract, and parse the files, how to build a data frame, and filter the data. He built this whole project out over time to solve his problem.

What have been the most popular posts on your site?

The most popular tends to be kind of deep and specific on Pandas. I think my most popular one is about the categorical data types. It's fairly in depth and it has those practical examples.

I also wrote about doing Monte Carlo analysis, my market basket analysis, and the pivot table and cross table examples are all pretty popular. I wrote about Windows Subsystem for Linux and that one's fairly popular as well. And of course, some of my earlier articles, which were about Excel and how to translate to Pandas are still pretty popular, just from the standpoint of how many people leave comments on them.

What are some of the best educational resources out there (besides Practical Business Python, of course)?

This is a hard one. It feels like there are just a ton of places right now.

Kevin Markham with Data School, he does some really great videos more from a data science perspective. A lot of scikit‑learn, I think he's just got some of the best explanations on that topic.

The Real Python tutorials are pretty good. That's where I tend to spend a lot of my time if it's a specific topic that I'm looking at.

Matt Harrison has a bunch of courses and are probably a little higher level, more complex topics that he covers, which, which I think are good. Automate the Boring Stuff from Al Sweigart is good. I like this course because it does align with Practical Business Python. It focuses more on real‑world tasks, and applied solutions.

What are you excited about looking forward?

One of the things we've talked about is that it will be easier for people to incorporate Python into their workflow and easier to share that those Python deliverables with others. I'm hoping that there will be more libraries that make it easy to tackle really challenging problems. One of the things I think about is time series forecasting. Almost every organization has some forecasting they need to do. And some organizations may have a team of PhDs that do that, but most just have some relatively unsophisticated Excel spreadsheets they use.

I'm excited about Facebook's Prophet library and other tools that are being developed, using deep learning and other approaches for time series forecasting. Python makes it really easy to generate some high quality sophisticated forecasts using state of the art algorithms without you really having to know all the behind-the-scenes math.

That's exciting to me. What are the other things that we can do now that in the past were really hard, but now we have libraries to make that a lot easier? That's what excites me as well as the general expansion of people that know Python and use Python and hopefully can level up organizations across the board.

This is something we think a lot about at Hex, where we're creating a platform that makes it easy to build and share interactive data products which can help teams be more impactful.

If this is is interesting, click below to get started, or to check out opportunities to join our team.