Data Types

Ha Khanh Nguyen - hknguyen

Scalar Types

Type Description
None The Python "null" value
str String type, holds Unicode (UTF-8 encoded) strings
bytes Raw ASCII bytes (or Unicode encoded as bytes)
float Double-precision (64-bit) floating-point number
bool A True or False value
int Arbitrary precision signed integer

1. Numeric types

2. Strings

2.1 Length of a string

2.2 String indexing & slicing

2.3 count()


What are the outcomes of the following commands?

2.4 replace()

2.5 String Concatenation

3. Booleans

4. Type Casting


The code segment below gives an error. Fix it using type casting.

This lecture note is modified from Chapter 2 of Wes McKinney's Python for Data Analysis 2nd Ed.