Skip to content
This repository was archived by the owner on Dec 30, 2025. It is now read-only.

Repository files navigation

Note: this repository should no longer be used. Please see https://github.com/falconair/lectures

Lecture notes for "Programming for Data Science", "Python for Data Science" and "Python for ML Engineering"

This repository contains lecture notes for classes offered by Shahbaz Chaudhary at the University Of Chicago's Masters in Applied Data Science program

Class setup

Please follow the instructions below to get your computer ready for this class.

Note Mac users: Once software is downloaded, if you double click to launch it, you may get permission errors. Try to right click on the downloaded software, pick "open" and continue. (Apple is trying to protect you from accidentally starting malware/virus)

Install Python (anaconda distribution)

Please install Python from this website: https://www.anaconda.com/download/ (modern computers are 64 bit so please pick that option)

Mac users: Accept all default prompts

Windows users: Accept all default prompts

Anaconda's distribution of Python is widely used in the industry, particularly among data scientists. This distribution makes it easy to use many libraries and packages for data analysis, building models, visualization, etc.

Once installed, please start jupyter notebook and execute code provided below

  1. Start Anaconda Navigator and click Launch on the panel labeled Jupyter Notebook
  2. Create new notebook from the web interface
  3. Execute this code:
%%timeit
sum(range(1_000_000))
  1. Execute this code:
from psutil import virtual_memory, disk_usage, cpu_count, os
bytes_in_gb = 1024**3
print("Memory:\t",round(virtual_memory().total/bytes_in_gb,4), "Gigabytes")
print("Disk:\t",round(disk_usage(os.path.abspath(os.sep)).total/bytes_in_gb,4), "Gigabytes")
print("CPUs:\t", cpu_count())

Clone this repository

  1. Visit this web page: https://github.com/falconair/ProgrammingForAnalytics
  2. Click "Clone or download" and pick the "Download ZIP" option (unless you already have a GitHub account)

The following steps are optional

Install Git and Git Bash

Please intall Git, a version control sotware, from this website: https://git-scm.com/downloads (you are ok to use default settings)

Note that this is a command-line tool. Once installed, you may not see a new icon to click. We will install a Desktop client to remedy this.

Although we don't make heavy use of version control, you will be introduced to the concept. Installing Git also installs "Git Bash," and comand line environment which simulates Unix/Linux. We will do several exercises which will require this environment.

Additional steps:
  1. Install a Graphical interface to Git from this website: https://desktop.github.com/
  2. [Windows users only] a. type cd (this will take you to your home directory) b. type echo cd >> .profile (this will make sure your home directory is loaded when you start Git Bash)

Install Visual Studio Code

Please install Visual Studio Code from https://code.visualstudio.com/

Additional steps:

Install Python extensions from https://marketplace.visualstudio.com/items?itemName=ms-python.python (visit that page and click "Install")

========

Table of Contents

ModuleClassDescription
Intro to consolesIntro to consolesThis lectures introduces the concept of a console, such as dos cmd or mac terminal, to students
Programming vs calculatorsProgramming vs calculatorHelps novices understand what features need to be added to a calculator to make it a fully programming environment
First programsFirst programsSeveral examples of small, but full programs which use all common programming constructs and data structures
Intro to JupyterIntro to Jupyter - not technicalProvides hsitorical context for Jupyter
Intro type Jupyter - technicalProvides a practioner specific intro to Jupyter
All of PythonAll of Python - faster basicsAn overview of Python for computer programmers (multi-week lecture)
All of Python - basicsAn overview of Python for novice or non-programmers: teaches programming constructs
All of Python - variables and tuplesTeaches multiple variable assignment
All of Python - basic functionsIntroduces functions
All of Python - numbersOverview of numbers and related operations
All of Python - stringsOverview of strings and related operations
All of Python - Boolean algebraDives deeper into the world of comparisons, and/or/not
All of Python - basic plottingGeneral matlab intro (not recommended for novices)
All of Python - dictionariesIntroduces Python dictionaries (aka maps, associative arrays)
All of Python - listsTeaches lists
All of Python - comprhensionsTeaches list and dictionary comprehensions (useful but intermediate feature)
All of Python - basic classesIntroduces classes and the very basics of object oriented programming
All of Python - loopsDescribes while and for loops
All of Python - conditionals and NoneDeeper dive into if/else conditions and Python's None type
All of Python - function argumentsDeeper dive into functions, including optional parameters
All of Python - lambda functionsIntroduces anaonymous functions (aka lambda functions)
All of Python - recursive functionsIntroduces the world of functions themselves
All of Python - regexesA very basic intro to regular expressions
Intro to NumpyNumpy quick startA broad overview of Numpy
Intro to PandasPandas - quick startA broad overview of Pandas
Pandas - SeriesA deeper dive into Pandas Series
Pandas - DataframesBuild up a dataframe using a collection of Series or a Numpy matrix, shows basic functioanality
Pandas - general operationsIntroduces additional dataframe operations
Pandas - combining: merge, join, concatShows how to combine multiple dataframes, similar to SQL joins
Pandas - groupbyShow how to break a population into subgroups and find aggregates for those subgroups
Pandas - IndexDoes a deep dive into Pandas indexes, a topic often not known to casual Pandas users
Pandas - reshape, pivot, melt, stackShows how to convert columns to rows and back, features similar to Excel's pivot table or cub rollup analysis
Pandas - operations: str, dt, applyShows how to apply string or date functions to Pandas series
Scikit learnScikit Learn - method behind the madnessDescribes Scikit learn's architecture and introduces pipes
Scikit Learn - Run saved modelsShows how to connect SKLearn models to the web (very basic)
Secret lives of text filesSecret lives of text filesDescribes encodings (UTF, ASCII), multi-byte characters, special characters such as \n and \t, etc.
How to read technical docsHow to read technical docs
Basic computer archtectureBasic computer architectureProvides a broad overview of a CPU, registers, floating points vs integers, disk vs memory speed differences
Python for AnalyticsFirst programsFirst programsSeveral examples of small, but full programs which use all common programming constructs and data structures
Intro to JupyterIntro to Jupyter - not technicalProvides hsitorical context for Jupyter
Intro type Jupyter - technicalProvides a practioner specific intro to Jupyter
All of PythonAll of Python - faster basicsAn overview of Python for computer programmers (multi-week lecture)
Intro to NumpyNumpy quick startA broad overview of Numpy
Intro to PandasPandas - quick startA broad overview of Pandas
Pandas - SeriesA deeper dive into Pandas Series
Pandas - DataframesBuild up a dataframe using a collection of Series or a Numpy matrix, shows basic functioanality
Pandas - general operationsIntroduces additional dataframe operations
Pandas - combining: merge, join, concatShows how to combine multiple dataframes, similar to SQL joins
Pandas - groupbyShow how to break a population into subgroups and find aggregates for those subgroups
Pandas - IndexDoes a deep dive into Pandas indexes, a topic often not known to casual Pandas users
Pandas - reshape, pivot, melt, stackShows how to convert columns to rows and back, features similar to Excel's pivot table or cub rollup analysis
Pandas - operations: str, dt, applyShows how to apply string or date functions to Pandas series
Scikit learnScikit Learn - method behind the madnessDescribes Scikit learn's architecture and introduces pipes
Scikit Learn - Run saved modelsShows how to connect SKLearn models to the web (very basic)
Programming for AnalyticsProgramming vs calculatorsProgramming vs calculatorHelps novices understand what features need to be added to a calculator to make it a fully programming environment
First programsFirst programsSeveral examples of small, but full programs which use all common programming constructs and data structures
Intro to JupyterIntro to Jupyter - not technicalProvides hsitorical context for Jupyter
Intro type Jupyter - technicalProvides a practioner specific intro to Jupyter
All of PythonAll of Python - basicsAn overview of Python for novice or non-programmers: teaches programming constructs
Secret lives of text filesSecret lives of text filesDescribes encodings (UTF, ASCII), multi-byte characters, special characters such as \n and \t, etc.
How to read technical docsHow to read technical docs
Basic computer archtectureBasic computer architectureProvides a broad overview of a CPU, registers, floating points vs integers, disk vs memory speed differences
Intro to NumpyNumpy quick startA broad overview of Numpy
Intro to PandasPandas - quick startA broad overview of Pandas
Lectures on R omitted

About

Course material for an intro to programming class for analytics students

Resources

Stars

20 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages