WA3174
Pragmatic Python Programming (Hands-on Advanced) Training
This intensive four-day hands-on course takes the attendees on a learning path that goes well beyond the basics of Python programming and teaches the participants the best practices for using Python.
Course Details
Duration
4 days
Prerequisites
- Participants are expected to have some Python programming experience.
- WA3016 Practical Python 3 Programming (Beginner) or equivalent experience.
Target Audience
- Developers
- Software Engineers
- Data Analysts
Course Outline
- Standing up Python Development Environment
- Python IDEs and REPLs
- VS Code vs PyCharm IDEs
- VS Code: Debugging Perspective
- PyCharm: Debugging Perspective
- Python Package Managers
- Core Pip Commands
- The Requirements File
- What are "Virtual Environments"?
- Tools for Creating "Virtual Environments"
- Creating Virtual Environments with the venv Tool
- Activating and Deactivating Virtual Environments
- Beyond the Basics of Python
- PEP8
- Hands-On Activities
- String Formatting and Interpolation
- Hands-On Activities
- Common Collection Functions and Operators
- Raw String Literals
- Accessing Python Lists
- Main Python List Methods
- Joining List Elements
- Hands-On Activities
- Set Operations with Sets
- Unpacking Tuples
- Conditional Expressions (a.k.a. Ternary Operator)
- Enumerate
- List Comprehension
- Dictionary Comprehension
- Hands-On Activities
- Zipping Lists
- Hands-On Activities
- Global and Local Variable Scopes
- Python Function Parameters: "Call By Sharing"
- Functions: Default Parameters
- Functions: Named Parameters
- Dealing with Arbitrary Number of Parameters
- Keyword Function Parameters
- Returning Multiple Values from a Function
- Docstrings
- A Very Basic Docstring Example of a Simple Function
- Hands-On Activities
- Lambda Functions in Python
- Examples of Using Lambdas
- Hands-On Activities
- Lambdas in the Sorted Function
- Closures
- Hands-On Activities
- Generators
- Where to Use Generators
- Example of a Generator
- Generator Expressions
- Random Numbers
- Regular Expressions
- The re Object Methods
- Using Regular Expressions Examples
- Python Collections
- The Counter Class
- Counter Class Example
- Python Object De/Serialization
- A pickle Example
- Profiling
- Python Built-in Profiling Capabilities
- Example of Code Execution Profiling
- Robust Programming Techniques
- Defining Robust Programming
- Assertions
- The assert Expression in Python
- Hands-On Activities
- What is Unit Testing and Why Should I Care?
- Unit Testing and Test-driven Development
- TDD Benefits
- Unit Testing in Python
- Steps for Creating a Unit Test in Python
- Running the Unit Tests
- A Unit Test Example
- Errors
- The try-except-finally Construct
- What's Wrong with this Error-Handling Code?
- Life after an Exception
- Assertions vs Errors (Exceptions)
- Hands-On Activities
- What is Logging and Why Should I Care?
- A Simple Print Statement vs Logging
- Logging Levels
- The Logger Hierarchy
- The Logging Levels
- Setting the Logging Level
- Configuring Logging Messages
- Example of Using Logging
- Logging in Python: December 9, 2021 Update
- Hands-On Activities
- Using Operating System Functionality in Python
- Interfacing with OS-Level Functionality in Python
- The os Module
- Interfacing with Files and Directories
- The os.path Module
- Process Management
- System Information
- The sys Module Overview
- Object Inspection and Dynamic Code Creation
- Object Inspection
- Object Inspection Example
- AST, Compile, and Exec
- Why is It Possible?
- Example of Dynamic Code Creation and Execution
- The eval Function
- Introduction to NumPy
- What is NumPy?
- The First Take on NumPy Arrays
- The ndarray Data Structure
- Understanding Axes
- Indexing Elements in a NumPy Array
- Re-Shaping
- Commonly Used Array Metrics
- Commonly Used Aggregate Functions
- Sorting Arrays
- Vectorization
- Vectorization Visually
- Broadcasting
- Broadcasting Visually
- Filtering
- Array Arithmetic Operations
- Reductions: Finding the Sum of Elements by Axis
- Array Slicing
- 2-D Array Slicing
- The Linear Algebra Functions
- Introduction to pandas
- What is pandas?
- The Series Object
- Accessing Values and Indexes in Series
- The DataFrame Object
- The DataFrame's Value Proposition
- Creating a pandas DataFrame
- Getting DataFrame Metrics
- Accessing DataFrame Columns
- Accessing DataFrame Rows
- Accessing DataFrame Cells
- Using iloc
- Using loc
- Examples of Using loc
- Filtering Rows
- DataFrames are Mutable via Object Reference!
- Deleting Rows and Columns
- Adding a New Column to a DataFrame
- Appending / Concatenating DataFrame and Series Objects
- Example of Appending / Concatenating DataFrames
- Getting Descriptive Statistics of DataFrame Columns
- Getting Descriptive Statistics of DataFrames
- Sorting DataFrames
- Reading From CSV Files
- Writing to a CSV File
- Simple Plotting with pandas
- A Plotting Example
- The pyplot Module
- Data Visualization in Python
- Why Do I Need Data Visualization?
- Data Visualization in Python
- Getting Started with matplotlib
- A Basic Plot
- Scatter Plots
- Figures
- Saving Figures to a File
- Seaborn
- Getting Started with seaborn
- Histograms and KDE
- Plotting Bivariate Distributions
- Scatter Plots in seaborn
- Pair plots in seaborn
- Heatmaps
- A Seaborn Scatterplot with Varying Point Sizes and Hues
- Securing Data with Python
- States of Digital Data
- Protecting Sensitive Data at Rest
- Hashing
- Secure Hashes in Python
- Salting
- An Example of Creating a Secure Hash in Python
- Hands-On Activities
- Keyed-Hashing for Message Authentication (HMAC)
- An HMAC Example
- Key Stretching (Derivation)
- Key Stretching in Python
- The scrypt Function
- Hands-On Activities
- Symmetric and Asymmetric (Public) Key Encryption
- Using the openssl Tool
- Lab Exercises
- Lab 1. Learning the CoLab Jupyter Notebook Environment
- Lab 2. Standing Up Python Development Environments
- Lab 3. Beyond the Basics of Python
- Lab 4. Robust Programming
- Lab 5. Using Operating System Functionality in Python
- Lab 6. Object Inspection and Dynamic Code Creation and Execution
- Lab 7. Programming with NumPy
- Lab 8. Programming with pandas
- Lab 9. Data Visualization using the seaborn-pandas Link
- Lab 10. Securing Data with Python
- Lab 11. Data Encryption with the openssl Tool (for Review)
- Lab 12. Keyed-Hashing for Message Authentication Project
- Lab 13. The Logging Project
- Lab 14. The pandas Project
- Lab 15. The Dynamic Object Creation Project