Data Analysis with Python & SQL
A Hands-On Beginner’s Guide
Preface
Welcome to this interactive textbook on Python and SQL for data analysis. This book is based on lecture notes from several courses I have been teaching at BI Norwegian Business School, such as Data Management and Python Programming and Python for Data Analysis, introducing master’s students to basic skills needed for business analytics.
Many of my students have asked me for years to publish the lecture notes and Jupyter notebooks used in these courses, so I have finally decided to convert them to this interactive textbook and make it available to everybody. I hope aspiring data analysts and scientists will find them useful when learning Python, SQL, and the basics of data analysis.
Modern society produces vast amounts of data continuously. Every minute, we generate enormous volumes of information, which companies need to collect, store, process, query, analyze, and visualize systematically, with the goal of extracting knowledge, making informed decisions, and innovation.
This book is aimed at beginners and intermediate users who want to bridge gaps between different areas of data analysis. We will introduce Python and SQL to get you started with automated data processing. At the same time, it is important to note that this book only scratches the surface. (These courses run for one semester, which limits how deep we can go.)
Why Python and SQL? There are many reasons. Python is easy to learn and works well for teaching. According to Kaggle’s Data Science and Machine Learning Survey (2022), Python and SQL are the two most common programming skills for data scientists.
This book is interactive, so you can, and should, execute every piece of code you see, try the exercises, and experiment with modifying the code to see what happens. Everything runs in your browser—no installation is needed. One unique and helpful feature of this book is the Explain button in some code cells, especially in the early chapters, which visualizes how the code executes. If you are new to programming, spend some time going step by step through the code to understand how different parts work.
Note that any changes you make to the code are not permanent. Closing the page, reloading it, or moving to the next page will erase your changes, so if you want to keep them, copy your code and exercise solutions to another location.
