Table of Contents
PYTHON FOR MBAs
Columbia University Press
Publishers Since 1893
New YorkChichester, West Sussex
cup.columbia.edu
Copyright 2021 Mattan Griffel and Daniel Guetta
All rights reserved
EISBN 978-0-231-55057-4
Library of Congress Cataloging-in-Publication Data
Names: Griffel, Mattan, author. | Guetta, Daniel, author.
Title: Python for MBAs / Mattan Griffel and Daniel Guetta.
Description: New York: Columbia University Press, [2021] | Includes index.
Identifiers: LCCN 2020032750 (print) | LCCN 2020032751 (ebook) | ISBN
9780231193924 (hardback) | ISBN 9780231193931 (trade paperback) | ISBN
9780231550574 (ebook)
Subjects: LCSH: Python (Computer program language) | Business--Data
processing.
Classification: LCC QA76.73.P98 G77 2021 (print) | LCC QA76.73.P98
(ebook) | DDC 005.13/3dc23
LC record available at https://lccn.loc.gov/2020032750
LC ebook record available at https://lccn.loc.gov/2020032751
A Columbia University Press E-book.
CUP would be pleased to hear about your reading experience with this e-book at .
Cover design: Noah Arlow
Contents
Hello! We are Mattan Griffel and Daniel Guetta, and were going to teach you about Python. Before we introduce ourselves, we want to tell you a little bit about the intended audience for this book, what well be learning together, and some tips on how you can get the most out of reading this book.
This book is designed for people who have never coded before; so if youre feeling intimidated, dont be. In fact, even if the only kind of Python youve heard of is a snake, or if youre not sure exactly what coding is, youll feel right at homewell discuss both in . Businesspeople without a technical background decide to start learning how to code for a lot of different reasons. Some want an introduction to a different way of thinkingthey realize the world runs on code, and they dont want to be left out. Some are looking for ways to write simple scripts to streamline or automate their work. Others work with coders and technical teams on a day-to-day basis and want to better understand what those teams do. Some are tired of relying on overworked business intelligence teams to get answers from their data and want to be more self-sufficient.
Whichever category you fall intothis book is for you. The material is based on classes we have taught for a number of years at Columbia Business School to professionals just like you. We are going to show you how to use Python to do all kinds of useful things, like automating repetitive tasks to save yourself time and money and performing data analyses to answer important business questions on files far too large and complex to be handled in a spreadsheet.
Hopefully, youll find that this book provides valuable insight into whats possible using technology and gives you a new skill that you can immediately use in a business context.
, well dive into ways Python can be used to analyze datasets in a real-world business context.
Unless you are already familiar with Python, you should begin by reading in order, from start to finishresist the temptation to jump around. You will learn the fundamental knowledge you need to do anything in Python. This part of the book also contains a number of exercises, and we encourage you to spend some time working on them. If you just read the book without trying these problems, youll still learn something, but you may not remember it as well. The companion website for this book contains digital versions of every piece of code, but for the same reason, we recommend typing it in by hand rather than just copying and pasting the code. If some questions pop into your mind like, What happens when I do X? then try doing it! In the worst-case scenario, it doesnt work. Then, you can revisit what we were showing you. Either way, youll learn something new.
to show you how to use massive datasets to answer these questions.
Our aim is to teach you the basics of Python and to provide you with a map so that you can decide what you want to learn more about on your own. As a result, well sometimes use informal terminology, and skip over some more technical details. This is a deliberate choice on our partit will prevent us from getting too bogged down with details that arent essential and will help you get to applications as quickly as possible. In our conclusion, we will point you to resources you can use to take what youve learned to the next level, if youre interested.
, as well as appendices on topics we did not have the space to cover in this book.
In writing this book, we benefited from the help of many people to whom we are infinitely grateful. First and foremost, the students who sat in our classes as we developed the material and gave us their invaluable feedbackif only we were sure not to forget anyone, we would name them all here. We are particularly thankful to (in alphabetical order) Joao Almeida, George Curtis, Nicholas Faville, Nicola Kornbluth, Royd Lim, Brett Martin, Veronica Miranda, Jason Prestinario, and Saron Yitbarek, all of whom took the time to read earlier versions of the manuscripts and give us their comments. It has been a privilege to be at Columbia Business School at a time of tremendous innovation in the area of technology and analytics. The school encouraged us to push the boundaries of what a traditional MBA class looks like, and this book was born of these efforts. We are particularly grateful to Dean Costis Maglaras and to members of the Decision, Risk, and Operations Division for their steadfast support. Last but not least, we are eternally grateful to Shereen Asmat, Molly Fisher, and Digs leadership team for graciously volunteering their time to talk to us about their company. At their request and to protect proprietary information pertaining to their business, many of the details in this book are based on our conversations but otherwise are fictionalized, and the dataset we work with was synthetically generated.
We both love coding, and we love sharing our excitement with othersthere is nothing like seeing a student run their first line of code, or their first data analysis. It has been a true pleasure taking our experience doing this in classrooms and converting it to a book for you to read. We look forward to going on this journey with you all!
From coronavirus-induced self-isolation in New York April 2020
Welcome to part 1 . Im Mattan Griffel and Im going to teach you a little bit about the basics of Python. Im going to try to make it interesting and explain some boring things in (hopefully) new and interesting ways. Let me first tell you a little bit about myself.
Im a two-time Y Combinatorbacked entrepreneur. I previously started a company called One Month, an online coding school that teaches people how to code in just thirty days, and Im currently the founder and chief operating officer of Ophelia, a telemedicine company focused on helping people overcome opioid addiction. Im also an award-winning faculty member at Columbia Business School, where I teach coding to MBA students and executives. Throughout my career, Ive taught tens of thousands of people how to code.
But I have a confession to make: I didnt start off as a coder, and I never got a degree in computer science. I began as in early-twenty-something in New York City with an idea for a startup. I was working in marketing as my first job out of college, and Id spend my evenings dreaming about my startup idea, but I had a problem: my idea required building software, and I didnt know anyone personally who could do that for me. I tried so hard to find a technical cofounder I went to hackathons and meetups and pitched people over drinksbut no luck.