Python for SAS Users

Chapter orginization

These chapters are meant to be read in order as they start with foundational concepts used to build up more complex ideas.

Chapter 00 -- Motivation

Chapter 01 -- Introduction

Chapter 02 -- Data Sctructures








Chapter 03 -- Data Types and Formatting



       Numerical Precision


       String Slicing

       String Formatting


Chapter 04 -- Pandas, Part 1

       Importing Packages



       Read .csv files


       Missing Values Identification

       Missing Value Replacement


Chapter 05 -- Understanding Indexes


       .iloc indexer

       Setting and resetting Indicies

       .loc indexer

        Mixing .loc indexer with Boolean Operations

        Altering DataFrame values using the .loc indexer

       Conditionaly Apply Values Based on Another Column Value

        .ix indexer

        Indexing Issues


Chapter 06 Hierarchical Indexing

       Multi Indexed Selection

       xs() method for Cross-sections

       Advanced Indexing with .loc Indexer

       Using Boolean Operators with .loc Indexer

       stack() and unstack() methods


Chapter 07 -- Pandas, Part 2

       SAS Sort/Merge with by-groups

       Inner Join

       Right Outer Join

       Left Outer Join

       Full Outer Join

       Outer Join no Matched Keys

       Outer Join no Matched Keys in Right

       No Matched Keys in Left

       Many-to-Many Join

       GroupBy: Split-Apply-Combine Introduction

       Replace Missing Values with Group Mean

       FIRST.variable and LAST.variable Processing


Chapter 08 -- Date, Time and Timepart Objects

       String Literal Mapped to datetime timestamp

       date objects

       strfime() and strptime() methods


       time objects

       timedelta objects


Chapter 09 -- Panda Time Series and Date Handling

       Creating and Manipulating a Fixed Frequency of Dates and Time Spans

       Time-Series Walk-through

       Returning Unique Levels of Categories

       Return a Row Using a Minimum Value

       Return a Row Using a Maximum Value

       Convert Time-Series from one Frequency to Another

       Plotting with bokeh


Chapter 10 -- GroupBy

       Setting Display Options

       Read 'pickled' DataFrame

       Create GroupBy Object

       GroupBy with Aggregations

       Understanding Binning

       Applying Functions to Groups

       Applying Transformations to Groups

       Top/Bottom N Processing


Chapter 11 -- Panda Readers

       pd.read_csv(URL) method

       SQLAlchemy Under the Covers

       read_sql_table() method


       DataFrame.to_sql() method

       pd.read_sas() method


Chapter 12 -- Additional Data Handling

       Sort and Sort Sequences

       Drop/Keep Columns

       Rename Columns

       Find Duplicate Values

       Drop Duplicate Rows

       Extract Duplicate Values

       Add a New DataFrame Column

       Cast Strings to Float

       Concatenating DataFrames (Join)



       Binning Continous Values

       Save to Disk ('pickling')