Programming with Python
Introduction
What to expect in 71 Python
Objectives of these lessons
What topic to discuss
Typical flow for a session
Conventions
Some Tips
Python
Installing Python with Anaconda
Jupyter Notebooks
Colab
Markdown
Software/Platforms for Markdown
1
Quick Reference
1.1
Brackets, ‘:’ ‘=’ and ‘==’
1.1.1
Brackets
1.1.2
Colon (:)
1.1.3
Equal Signs (=)
1.2
Comments
1.3
Colab
1.3.1
File Upload/Download
1.4
Indexing and Slicing
1.4.1
1 D Python List
1.4.2
2D Numpy Array
1.5
Storing Data
1.5.1
Using Python Dictionaries to store data
1.5.2
Pandas DataFrame
1.5.3
Using Python Lists to store date
1.5.4
Using Numpy Arrays to store data
1.5.5
Python Lists vs. Numpy arrays
1.6
Conditionals or Decisions (if)
1.7
Loops
1.7.1
For
1.7.2
While
1.7.3
Break
&
Continue
1.7.4
List Comprehension
1.8
Our Own Functions
1.8.1
Named Functions (Basic definition)
1.8.2
Named Functioons (with Default Arguments)
1.8.3
Named Functions (Some cool features)
1.9
Importing Modules
1.10
Mathematics
1.11
Getting Help
1.12
Formatting Strings
1.13
Some Python Concepts
1.13.1
Mutability
1.13.2
Data Types
2
Navigating the OS
2.1
Some basic questions you should think about
2.2
Before the lesson
2.3
Exercise on OS
2.3.1
Scenario
2.3.2
What you have to do
3
Plotting with Python
3.1
Making Quick Exploratory plots
Example 1 : Simple Start
Example 2 : Error Bars
Example 3 : Two Y Axes
Example 4 : Fill Between
3.2
Plots with Multiple Axes
Example 5 : CO
\(_2\)
Data
Example 6 : 2 x 2
3.3
Exercise on Plotting
4
The Power of Dataframes
Note
All Files
4.1
Pandas Basics
4.1.1
Introduction (Part 1)
4.1.2
Introduction (Part 2)
4.1.3
Introduction (Part 3)
4.2
Making Quick Exploratory plots
Hello Iris
Example 1 : Bar Chart
Example 2 : Stacked Bar Chart
Example 3 : Histrogram
Example 4 : Scatter Plot
Example 5 : Pie
Example 6 : Box & Whiskers Plots
Example 7 : Scatter matrix!
4.3
Exercise 1: Students in Majors
4.3.1
A Solution
4.4
The Convenience of Dataframes
4.4.1
(Mini Exercise) Method 1: Using a Spreadsheet
What you have to do
4.4.2
Method 2: Using a Dataframes
4.5
A step farther with Pandas: An example
First explore a bit
Lets analyse
4.6
Exercise 2: Graduate Data
4.6.1
A Solution
5
API & Web Scraping
5.1
API
5.2
Web Scraping
6
Algorithms: The Thinking Behind the Programming
6.1
Visualise Your Code
6.2
Examples & Exercises
7
The Importance of Being Random
7.1
Random Numbers
7.1.1
Random Numbers
7.1.2
RNG vs PRNG
7.1.3
What is ‘seeding?’
7.1.4
Using
numpy
for random numbers
7.2
Random Examples & Exercises
8
Image Analysis I
What we have in store
8.1
Image Basics
8.2
Image Layers (or Channels)
8.3
Array Gymnastics: Examples & Exercises
8.4
Roberts’s Golgi
8.5
Roberts’s Golgi: Examples & Exercises
9
Image Analysis II: Segmentation Ananlysis
What we have in store
References
9.1
Segmentation Example
9.2
Segmentation Exercise
10
Numerical Integration
Capturing the Dynamics Around Us
10.1
The Euler Method
10.2
Numerical Modelling: Examples & Exercises
Cheat!
Numpy
Pandas
11
Past Tests
11.1
2017 and 2019
Instructions
1. Outline your strategy.
2. The Task
11.2
2018
Instructions
The Task
Outline your strategy.
Things to note:
SP2171|Python
9.1
Segmentation Example