Foundations

Python Simplified

Python from the first variable to files, functions and the habits data work needs.

  • Handwritten-style
  • Diagrams and tables
  • Worked examples

Who this notebook is for

Anyone starting Python for data work, including people who have never programmed. It begins at the first variable and builds up to the habits data jobs expect.

What you will be able to do

  • Write loops, conditionals and functions without copying a template
  • Choose between a list, tuple, set and dictionary for a given job
  • Read and write files and handle errors so a script does not crash on bad rows
  • Use comprehensions, modules and classes the way real pipeline code does

What's inside

Pick a chapter and the notebook opens right there.

  1. Introduction to PythonOrigin, Zen, Execution flow, Bytecode & PVMStart here
  2. Getting StartedInstallation, PATH, REPL, Running Scripts, print() anatomyStart here
  3. Variables & Data TypesNaming rules, Integers, Floats, Mutability & Memory IDsStart here
  4. Operators & ExpressionsArithmetic, Bitwise, Comparison, Logical Short-circuitingStart here
  5. Input & Outputinput() input() parsing, Typecasting traps, f-string formatting parsing, Typecasting traps, f-string formattingStart here
  6. StringsImmutability, Slicing steps, 25+ String methods, UTF-8 EncodingStart here
  7. Conditionalsif-elif-else, Ternary operator, Truthy/Falsy evaluationsStart here
  8. Loops & Iterationwhile loops, for-range loops, break/continue, loop-else clauseStart here
  9. ListsDynamic arrays, List slicing, In-place mutation vs copying, Nested gridsStart here
  10. TuplesImmutability guarantees, Tuple packing/unpacking, Named tuplesStart here
  11. SetsHash sets, Deduplication, Mathematical Venn operations (union, intersect)Start here
  12. DictionariesHash maps, Key hashability, Dict comprehensions, Hash maps, Key hashability, Dict comprehensions, defaultdict defaultdictStart here
  13. FunctionsPositional/keyword args, Positional/keyword args, *args *args / / **kwargs **kwargs, Lambda, Closures, Lambda, ClosuresStart here
  14. ComprehensionsList, Set, and Dict comprehensions vs map/filterStart here
  15. Modules & Packagesimport import system, system, __init__.py __init__.py,, __name__ == '__main__' __name__ == '__main__'Start here
  16. File HandlingContext managers ( Context managers ( with with ), Reading large files, JSON & CSV ), Reading large files, JSON & CSVStart here
  17. Exception Handlingtry-except-else-finally, Custom errors, Traceback chainingStart here
  18. Object-Oriented PythonClasses, Classes, self self, Inheritance, Polymorphism, Encapsulation, Inheritance, Polymorphism, EncapsulationStart here
  19. Advanced PythonIterators, Iterators, yield yield Generators, Custom Decorators, Dunder methods Generators, Custom Decorators, Dunder methodsStart here
  20. Interview MasterclassMemory/GC, Pydantic v2, TaskGroup, Polars/Arrow, 25+ Q&A MatrixStart here
  21. Gap-Fill Supplementlogging, subprocess, resilient HTTP/boto3, heapq/itertools, profiling, uv/Poetry, pytest for pipelinesStart here

Practice this

Put it to work on LakeBench.

Read the guide first

Short explainers that pair with this notebook.

Common questions

Do I need to know programming before this notebook?
No. It starts with what a variable is and what Python prints, then adds one idea at a time. The notebook closes with an interview chapter so you can test what you learned.
Is this Python for data engineering or general Python?
It teaches core Python, with the file handling, error handling and data structure choices that data engineering work leans on. It does not cover web frameworks.
Can I read a sample before I commit?
Yes. The contents pages and the first pages of every notebook can be read online, so you can judge the style before going further.

More in Foundations

All notebooks