Python for Data & Analytics

Python for Data & Analytics

A Business-Oriented Approach

Edition 1.0 | Copyright 2023 | Publication Date: October 2022

Daniel Groner, Fordham University


Python for Data & Analytics introduces essential programming concepts using Python, pandas, and other packages for the purpose of accessing data and performing analyses, and developing applications. The presentation presumes no prior programming experience. It is designed for introductory and more advanced programming courses in a data analytics, information systems, or business program. To this end, business examples are emphasized throughout. Various topics often covered in a computer-science-oriented course are purposefully not included in this textbook including topics like recursion and sorting algorithms. 


Impart data analytics skills
Explore programming to access, prepare, analyze, and present data.

Explore the power and convenience of Python notebooks
Traditional introductions teach computer programming primarily as a sequence of statements called programs. Today, Python is still used in programs but it is also used for interactive data analysis and in a hybrid technique called a notebook. This text introduces all three approaches.

Jumpstart learning with spreadsheet analogies
As appropriate, analogies are presented relating Python concepts to spreadsheets to leverage students' prior knowledge. To watch Professor Groner discuss spreadsheet analogies and videos click here.

Animate learning
Key programs are animated and narrated using "CodeInMotion" videos that reveal the "living and breathing" dynamics of code. (see the "Videos" section.)

Cement understanding
In-class exercises assure that students can apply each successive concept.

Prepare students for business
Highly-relevant examples are drawn from finance, logistics, marketing, accounting, health, and other functional areas. They are real (or realistic), not too complex, and explained in detail.


"The approachable writing style, the succinct chapters, and the ease of reading will appeal to my students. [It] is difficult to teach the students how to program and how to perform data analysis in a single course. This book would make that task easier."
--Dr. Mary Lebens, Metropolitan State University

"The progression builds up, and that’s a good call. …I really was pleased with the atomicity of each section, they didn’t feel like big leaps, and they didn’t seem like they were repeating the same thing in a dozen different ways."
--Dr. Theodore Larson, University of North Texas Dallas

"This chapter has a good discussion of cleaning and preparing data using Python and Pandas. Not many introductory Python books go into Pandas, let alone data preparation. This discussion would be extremely useful for students who plan to go into analytics."
--Dr. Anthony Varghese, University of Wisconsin-River Falls

"I think the biggest strength of the book is the animated videos--very great! This makes the book good for an online course or hybrid course especially at this time when many courses are moving online."
--Dr. Neba Nfonsang, University of Denver

"The book reaches a balance of appealing to beginners without scaring away more adept programmers."
--Dr. Hilde Patron, University of West Georgia

"Where was this book 3 years ago when I had to design my course?!"
--Dr. Adrian Gardiner, Georgia Institute of Technology

Table of Contents

Detailed Table of Contents PDF


Chapter 1: Introduction to Programming and Python
Chapter 2: Variables and Statements
Chapter 3: Decisions
Chapter 4: Repetition
Chapter 5: Defining Functions
Chapter 6: Lists
Chapter 7: Reading and Writing Files
Chapter 8: Strings in Detail
Chapter 9: Dictionaries and Sets


Chapter 10: pandas DataFrames and Series
Chapter 11: pandas for Data Preparation
Chapter 12: Reading Web Pages with pandas and Beautiful Soup
Chapter 13: Accessing Web APIs with Requests and JSON
Chapter 14: Querying Databases with Python and SQL
Chapter 15: Accessing Spreadsheets with pandas and openpyxl


Chapter 16: Visualization
Chapter 17: Statistics
Chapter 18: Text Analysis
Chapter 19: Case Study: Customer Retention Analysis


Appendix A: Getting Started With . . .
Appendix A1: Getting Started with Jupyter Notebook
Appendix A2: Getting Started with Google Colab
Appendix A3: Getting Started with Thonny
Appendix A4: Getting Started with Spyder
Appendix A5: Getting Started with PyCharm
Appendix A6: Getting Started with Anaconda
Appendix A7: Getting Started with Third-Party Packages


Appendix B: Importing Packages and Modules
Appendix C: Formatting
Appendix D: Handling Errors with Exceptions
Appendix E: Defining Classes: Object-Oriented Programming
Appendix F: Reading Files: Recap

About the Author

Daniel Groner is an assistant clinical professor of information systems at the Gabelli School of Business at Fordham University. He received his B.S. and M. Eng. degrees in Operations Research from Cornell University, and his MBA from the University of Chicago. He has over 35 years of experience in business analytics systems spanning finance (risk management, portfolio analysis, market intelligence), logistics, and marketing, with a focus on optimization-based models. In 2017, he founded Rose River Software, which develops interactive visualization tools for teaching programming languages. He has also co-authored several books on Java. 

Daniel Groner

Instructor Resources

Prospect Press provides instructors with an instructor manual, lecture slides and a test bank for each title.
Some texts have additional resources including case teaching notes, tutorials, and addenda.
This content is available to instructors only and is password protected.

Resources Login


2-2 Set and display a variable with a label
2-3 Set, reset and display a variable
2-4 Input and display a string variable
2-5 Input and total numbers
2-6 Calculate BMI, given height and weight
3-6 CD Calculator with 2 Rates: if/else
3-8 CD Calculator with 3 Rates: if/elif/else
3-9 CD Calculator with customer type: if and nesting
4-1 while repetition with squares and cubes
4-2 while repetition – cumulate a set of numbers
4-3 while repetition – find maximum of a set of numbers
4-4 while repetition with a control variable – BMI
4-6 while repetition with a special ending value – BMI
4-8 for repetition with squares and cubes
5-1 Greeting function – 1 input parameter
5-2 Book order cost – 1 input parameter and 1 returned result
5-3 Book order cost – 2 input parameters and 1 returned result
6-1 Translate AQI from number to color
7-1 Read a line from a file, display to screen
7-2 Using while, read lines from a file, display each line to screen
7-3 Using for, read lines from a file, display each line to screen
7-7 Writing a line to a file
8-1 Simple text processor with assignment and concatenation
9-1 Build a contact directory from user input

Ordering Information

Student Orders

Student Price
ISBN: 978-1-943153-98-5
Student Price
$93.85 + shipping
ISBN: 978-1-943153-99-2

Order directly from our distributors:

What's the difference between these two?

Bulk eTextbook Orders
Bookstores may order eTextbooks in bulk directly from RedShelf or VitalSource. Please contact customer support for additional information.

VitalSource: VitalSource Bulk Order

Bulk Paperback Orders
Bookstores may order paperbacks in bulk directly from RedShelf by going to the following link. Please contact customer support for additional information.

RedShelf: RedShelf Print Orders

BNED stores
Follow your usual ordering procedures.

Frequently Asked Questions

Individual Paperback Orders
To purchase an individual book, go to the Prospect Press webpage for that book and follow the link to RedShelf or go directly to the RedShelf website using the link below, search for the title, and order there.

Bulk Paperback Orders
To purchase paperbacks in bulk contact RedShelf using the link below:

If you have any particular questions about bookstore orders please contact

VitalSource VS RedShelf

RedShelf eTextbook
VitalSource eTextbook
Online or download
Online only
Online and Download
Permanent online access
365-day access for online, perpetual download
Yes, within 14 days from purchase
Yes, within 14 days from purchase
Where can I buy this online?
Go to and search by author name, title, or ISBN.
Go to and search by author name, title, or ISBN
Can I buy this in the campus bookstore?
Yes, at selected campus and university bookstores. Check if your bookstore sells RedShelf ebooks.
Yes, at selected campus bookstores. Check if your bookstore sells VitalSource ebooks.
For more info: