9 From Pyret to Python |
9.1 From Pyret to Python |
9.1.1 Expressions, Functions, and Types |
9.1.2 Returning Values from Functions |
9.1.3 Examples and Test Cases |
9.1.4 An Aside on Numbers |
9.1.5 Conditionals |
9.1.6 Creating and Processing
Lists |
9.1.6.1 Filters, Maps, and Friends |
9.1.7 Data with Components |
9.1.7.1 Accessing Fields within Dataclasses |
9.1.8 Traversing Lists |
9.1.8.1 Introducing For Loops |
9.1.8.2 An Aside on Order of Processing List Elements |
9.1.8.3 Using For Loops in Functions that Produce Lists |
9.1.8.4 Summary: The List-Processing Template for Python |
9.2 Dictionaries |
9.2.1 Creating and Using a Dictionary |
9.2.2 Searching Through the Values in a Dictionary |
9.2.3 Dictionaries with More Complex Values |
9.2.4 Dictionaries versus Dataclasses |
Summary |
9.3 Arrays |
9.3.1 Two Memory Layouts for Ordered Items |
9.3.2 Iterating Partly through an Ordered Datum |
10 Tables in Python via Pandas |
10.1 Introduction to Pandas |
10.1.1 Pandas Table Basics |
10.1.1.1 Core Datatypes: DataFrame and Series |
10.1.1.2 Creating and Loading DataFrames |
10.1.1.3 Using Labels and Indices to Access Cells |
10.1.2 Filtering Rows |
10.1.3 Cleaning and Normalizing Data |
10.1.3.1 Clearing out unknown values |
10.1.3.2 Repairing Values and Column Types |
10.1.4 Computing New Columns |
10.1.5 Aggregating and Grouping Columns |
10.1.6 Wide Versus Tall Data |
Converting Between Wide and Tall Data |
10.1.7 Plotting Data |
10.1.8 Takeaways |
10.2 Reshaping Tables |
10.2.1 Binning Rows |
10.2.2 Wide versus Tall Datasets |