Module 1: Python Fundamentals

Module Overview

This module introduces you to essential Python programming concepts for data science. You'll learn how to navigate Google Colab, understand Python's fundamental data types, work with conditional statements, implement loops, create functions, and use imports. These foundational skills will prepare you for working with data in Python and using various data science tools and libraries.

Learning Objectives

Detailed Objective: Understanding Python Data Types

Different Python types may have different definitions and, therefore, different behaviors. Understanding the subtle differences between data types will help you become a better coder.

Value Types

Name Type Description Code
String str Used to represent a text value "bloomtech"
Integer int Discrete numerical values 42
Float float Continuous numerical values 3.14
Boolean bool Binary logical propositions True

Container Types

Name Type Description Code
List list Indexed, mutable order, and allow duplicate values [1, 2, 3]
Tuple tuple Indexed, immutable order, and allow duplicate values (1, 2, 3)
Set set Unindexed, unordered, and do not allow duplicate values {1, 2, 3}
Dictionary dict Keyed index, immutable order, changeable values {"a": 1, "b": 2, "c": 3}

Container Types: Pandas (pd) and Numpy (np)

Name Type Definition
Numpy Array np.array One-dimensional sequence of data (like a list of values)
Numpy Matrix np.matrix Two-dimensional sequence of data (like a list of lists)
Pandas Series pd.Series One-dimensional sequence of data (like a list of values)
Pandas DataFrame pd.DataFrame Multi-dimensional sequence of data (like a list of lists)

Type Methods

Each data type has different methods that represent the behavior of an object. Methods are associated with a specific object type. For example, a list has the .append() method associated with it for adding values to the end of the list.

my_list = [1, 2, 3]
my_list.append(4)
print(my_list)
# Output: [1, 2, 3, 4]

There are many more data types you will be studying and using throughout this course.

Guided Project

Open DS_111_Intro_to_Python.ipynb in the GitHub repository below to follow along with the guided project:

Resources