Python for Predictive Analytics
ISOM 835 assumes you can read and write basic Python and pandas. This track gets you there — or back there — in about twenty hours, at your own pace. Start with Python, Guided: seven lessons you read, run, and get graded on without leaving the page. Then go deeper with Prof. Arslan's ISOM 730 modules — slides, lecture notebooks, exercises, and a challenge for every level — and the best free resources on the web.
Seven levels, one notebook habit
Each level: what you will be able to do, Prof. Arslan's slides and notebooks, exercises and a challenge, and the two or three outside resources worth your time.
Setup & your first notebook
Colab is a Python notebook in your browser: cells you run one at a time, text and code side by side. Learn the five keystrokes you will use ten thousand times.
- Open a Colab notebook, run a cell (Shift+Enter), add a cell, save a copy to Drive
- Read an error message from the bottom up
- Print, comment, and ask Colab's assistant for help — then verify what it wrote
- Interactive Python, Guided — Lesson 0 (read, run, get graded)Start here: the lesson, runnable examples, and graded exercises, all in the browser.
- Notebook Module 0 — introduction activity (Prof. Arslan)A ten-minute first notebook: run, edit, break, fix.
- Interactive Python Tutor — visualize code line by linePaste any short program and watch variables change step by step. The single best tool for understanding what a loop does.
- Interactive Kaggle Learn — PythonSeven short lessons with exercises, no setup. If you have never written Python, start here tonight.
Python foundations
Expressions, variables, and types; conditionals and try/except; functions with arguments and return values; while and for loops with break and continue. Everything else in the course is built from these.
- Write numeric expressions and understand operator precedence
- Direct control flow with if / elif / else and handle errors with try / except
- Define and reuse functions with any number of arguments; know when a function returns nothing
- Automate repetition with definite (for) and indefinite (while) loops
- Interactive Sessions 1–2 review — the four decks, what to take away, and Lab 0What we covered in class from chapters 2–5, one worked churn example per chapter, the slides embedded, and the self-checking Python Foundations Check.
- Interactive Python, Guided — Lesson 1 (read, run, get graded)Start here: the lesson, runnable examples, and graded exercises, all in the browser.
- Slides Slides 02 — Expressions & variables
- Slides Slides 03 — Conditional execution
- Slides Slides 04 — Functions
- Slides Slides 05 — Iterations
- Notebook Lecture notebook — Introduction to Python (Fall 2025)
- Notebook Lecture notebook — Loops, iterations, functions (Fall 2025)
- Exercises Module 1 exercisesThree questions on expressions, conditionals, and loops.
- Challenge Module 1 challenge
- Interactive py4e — Python for Everybody (Severance)The free course these slides descend from: videos, a free book, and autograded exercises for every chapter.
- Interactive CS Circles — Waterloo's interactive PythonShort lessons with exercises graded in the browser. Excellent for loops and functions.
- Reading Python docs — The official tutorial, chapters 3–4When you want the precise rule, not a metaphor.
Strings, files & lists
Objects carry data and methods. Strings and lists are the first two you will use in every notebook; files are the memory that outlives your program.
- Slice, search, and format strings; use the built-in string methods with confidence
- Open, read, and iterate a text file line by line
- Build, index, slice, sort, and mutate lists; use list methods and comprehensions
- Interactive Python, Guided — Lesson 2 (read, run, get graded)Start here: the lesson, runnable examples, and graded exercises, all in the browser.
- Slides Slides 06 — Strings
- Slides Slides 07 — Files
- Slides Slides 08 — Lists
- Slides Practice questions (slides) — Module 2Five questions on Module 1 material, plus an introduction to HackerRank's Python track.
- Notebook Lecture notebook — Lists & dictionaries (Fall 2025)
- Exercises Module 2 exercisesStrings, reading a file line by line, lists with loops.
- Challenge Module 2 challenge — sum of primes below 5,000
- Reading W3Schools — Python string formatting & list methodsThe quickest reference on the web; the list-methods page is one click away.
- Reading Automate the Boring Stuff — Chapters 6 and 9Free book. Strings and files, taught through tasks you actually want to automate.
Dictionaries, tuples & the web
A dictionary is a set of counters — the idiom behind every "rate by group" you will compute. Tuples are hashable and comparable, so you can sort lists of them and use them as keys. Then Python pretends to be a browser.
- Count frequencies with a dictionary and the .get(key, 0) idiom; iterate keys, values, and items
- Sort a list of tuples by any field; use tuples as dictionary keys
- Retrieve a web page with urllib / requests and parse it with BeautifulSoup
- Interactive Python, Guided — Lesson 3 (read, run, get graded)Start here: the lesson, runnable examples, and graded exercises, all in the browser.
- Slides Slides 09 — Dictionaries
- Slides Slides 10 — Tuples
- Slides Slides 12 — HTTP & scraping
- Notebook Module 3 lecture notebook — dictionaries as counters, top-10 wordsThe hotel dictionary, counting names, the most-common-word program, sorting tuples.
- Exercises Module 3 exercisesStrings + dictionaries, tuples + dictionaries, scraping a static page.
- Challenge Module 3 challenge — FizzBuzzThe classic interview question. Simple, and tricky for some.
- Notebook API call — Polygon.io financial data (Fall 2025)A real REST API: request, JSON, DataFrame.
- Reading Whirlwind Tour of Python (VanderPlas) — Data structuresA free, fast, precise tour for people who already program in something else.
- Interactive regex101When you need to pull a pattern out of messy text, test the regular expression here first.
pandas: working with data
The library the whole course runs on. Read a CSV, look at it, select rows and columns, summarize, group, merge — and clean the column that was secretly a string.
- Load data from CSV, Excel, URLs, and APIs into a DataFrame
- Select with .loc / .iloc and boolean masks; add and transform columns
- Summarize with describe / value_counts; aggregate with groupby; combine tables with merge
- Recognize the three merge shapes (one-to-one, many-to-one, many-to-many) and check row counts
- Interactive Python, Guided — Lesson 4 (read, run, get graded)Start here: the lesson, runnable examples, and graded exercises, all in the browser.
- Notebook Module 4 lecture notebook — exploratory data analysis with pandas (Prof. Arslan)Series and DataFrames, indexing, summaries, groupby, and the three kinds of joins.
- Slides pandas library introduction (slides)
- Slides Slides 13 — Web services & APIs
- Exercises Module 4 exercisesA headless-browser scrape, then two pandas questions.
- Challenge Module 4 challenge — Olympic medals 1896–201435,000 medals; the best pandas workout in the archive.
- Exercises Pandas exercises (Prof. Arslan's Drive folder)Chipotle, occupations, and friends — the guipsamora set, curated.
- Exercises guipsamora/pandas_exercises (GitHub)The original repository: 15 topics, each with an exercise notebook and a solution notebook.
- Reading pandas — 10 minutes to pandas
- Reading pandas cheat sheet (PDF)Two pages. Print it.
- Reading pandas for spreadsheet usersEvery Excel habit, translated.
- Interactive Kaggle Learn — PandasSix lessons with exercises on a wine-reviews dataset.
- Reading McKinney — Python for Data Analysis, 3rd ed. (free online)By the creator of pandas. Chapters 5–8 are the reference for this level.
Visualization
A chart is an argument. matplotlib draws anything; seaborn draws the statistical charts you need with one call and integrates with DataFrames.
- Make and label line, bar, scatter, and histogram charts in matplotlib; save a figure
- Use seaborn for distributions, pair plots, categorical comparisons, and heatmaps
- Choose the chart that answers the question, and title it with the answer
- Notebook Module 5 lecture — data visualization with matplotlib & seaborn (Prof. Arslan)
- Notebook Seaborn examples in Python (Fall 2025)
- Exercises Module 5 exercisesBar plots, scatter plots, pair plots — when and why.
- Challenge Module 5 challenge — top-rated movie directors
- Reading Seaborn tutorial
- Reading Matplotlib cheat sheetsOfficial, two pages, everything.
First scikit-learn
Choose a model, set its hyperparameters, arrange X and y, fit, predict. The estimator API is the same for every model in the course — learn it once here at a gentle pace, then Session 1 moves fast.
- Arrange a features matrix and a target vector; split train and test
- Fit and evaluate a model with the scikit-learn estimator API
- Recognize overfitting and use a validation set or cross-validation
- Interactive Python, Guided — Lesson 5 (read, run, get graded)Start here: the lesson, runnable examples, and graded exercises, all in the browser.
- Notebook Introducing scikit-learn (Prof. Arslan)
- Notebook Model validation & selection (Prof. Arslan)
- Notebook Introduction to scikit-learn (Fall 2025 Colab)
- Exercises Module 6 exercises — Naive Bayes, SVM, lasso on scikit-learn datasets
- Interactive Neural Numbers — train a digit recognizer in your browserDraw a digit, watch the network guess, then train it yourself. Pure delight.
- Interactive Kaggle — Titanic tutorial: how a competition worksYour first submission, step by step — the muscle memory you need for the midterm competition.
Where to get your reps
Programming is a motor skill. Ten minutes a day in one of these beats three hours on a Sunday.
Keep these open
Slide decks are Google Slides (view-only). Notebooks marked "Prof. Arslan" open in Colab from this course's repository; Fall 2025 lecture Colabs open from Drive. Everything here is free.
Six lines you will type all semester
counts[key] = counts.get(key, 0) + 1df['price'] = df['price'].str.replace('[$,]', '', regex=True).astype(float)df.groupby('contract')['churn'].mean().sort_values(ascending=False)pd.to_numeric(df['TotalCharges'], errors='coerce')df.loc[df['tenure'] < 12, ['customerID', 'MonthlyCharges']]pd.read_csv('https://raw.githubusercontent.com/harslan/isom-835/master/public/data/telco_churn.csv')