Module 7: Importing Files and the Coding Style Guide

In this module, you will learn about how to import files and libraries from other directories and stylize your code for optimal readability.

0Module Learning Outcomes

1Importing Python Libraries

2Importing packages

3Importing a Package Function

4Importing Packages... Again

5Working with Other Files

6Importing Your Own Functions Questions

7More Importing Your Own Functions Questions

8Testing Your Own Functions with Pytest

9Using Pytest Questions

10More Questions on Using Pytest

11Making a Test Function

12Automatic Style Formatters

13Flake8 and Black

14Formatting your Code

15Formatting That Can't Be Fixed Automatically

16Writing Useful Comments

17Choosing Good Variable Names

18The Python Debugger

19Using the Python Debugger

20What Did We Just Learn?

About this course

Learn the fundamentals of programming in Python, including how to clean, filter, arrange, aggregate and transform data. You will learn the foundations of programming in Python while writing human-readable code that sets a foundation of best practices and coding style. You will gain the skills to clean, filter, manipulate (wrangle) and summarize data using Python libraries for more effective data analysis. An overview of data structures, iteration, flow control and program design relevant to data exploration and analysis will be addressed along with fundamental programming concepts such as loops, conditionals and data structures that create a solid foundation in data science programming.

About the program

The University of British Columbia (UBC) is a comprehensive research-intensive university, consistently ranked among the 40 best universities in the world. The Key Capabilities in Data Science program was launched in September 2020 and is developed and taught by many of the same instructors as the UBC Master of Data Science program.