III From Pyret to Python

    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

 Filters, Maps, and Friends

        9.1.7 Data with Components

 Accessing Fields within Dataclasses

        9.1.8 Traversing Lists

 Introducing For Loops

   An Aside on Order of Processing List Elements

 Using For Loops in Functions that Produce Lists

 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


      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

 Core Datatypes: DataFrame and Series

 Creating and Loading DataFrames

 Using Labels and Indices to Access Cells

        10.1.2 Filtering Rows

        10.1.3 Cleaning and Normalizing Data

 Clearing out unknown values

 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