Python Polars

by Jeroen Janssens and Thijs Nieuwdorp

Data Science

Book Details

Book Title

Python Polars

Author

Jeroen Janssens and Thijs Nieuwdorp

Publisher

O'Reilly Media, Inc

Publication Date

2025

ISBN

9781098156084

Number of Pages

653

Language

English

Format

PDF

File Size

3.5MB

Subject

python

Table of Contents

  • Foreword
  • Preface
  • I. Begin
  • 1. Introducing Polars
  • What Is This Thing Called Polars?
  • Why You Should Use Polars
  • Polars Compared to Other Data Processing Packages
  • Why We Focus on Python Polars
  • How This Book is Organized
  • An ETL Showcase
  • Takeaways
  • 2. Getting Started
  • Setting Up Your Environment
  • Crash Course JupyterLab
  • Installing Polars on Other Projects
  • Configuring Polars
  • Compiling Polars from Scratch
  • Takeaways
  • 3. Moving from Pandas to Polars
  • Animals
  • Similarities to Recognize
  • Appearances to Appreciate
  • Concepts to Unlearn
  • Syntax to Forget
  • To and From Pandas
  • Takeaways
  • II. Form
  • 4. Data Structures and Data Types
  • Series, DataFrames, and LazyFrames
  • Data Types
  • Data Type Conversion
  • Takeaways
  • 5. Eager and Lazy APIs
  • Eager API: DataFrame
  • Lazy API: LazyFrame
  • Performance Differences
  • Functionality Differences
  • Tips and Tricks
  • Takeaways
  • 6. Reading and Writing Data
  • Format Overview
  • Reading CSV Files
  • Parsing Missing Values Correctly
  • Reading Files with Encodings Other than UTF-8
  • Reading Excel Spreadsheets
  • Working with Multiple Files
  • Reading Parquet
  • Reading JSON and NDJSON
  • Other File Formats
  • Querying Databases
  • Writing Data
  • Takeaways
  • III. Express
  • 7. Beginning Expressions
  • 8. Continuing Expressions
  • Types of Operations
  • Element-Wise Operations
  • Nonreducing Series-Wise Operations
  • Series-Wise Operations that Summarize to One
  • Series-Wise Operations that Summarize to One or More
  • Series-Wise Operations that Extend
  • Takeaways
  • 9. Combining Expressions
  • Inline Operators Versus Methods
  • Arithmetic Operations
  • Comparison Operations
  • Boolean Algebra Operations
  • Bitwise Operations
  • Using Functions
  • Takeaways
  • IV. Transform
  • 10. Selecting and Creating Columns
  • Selecting Columns
  • Creating Columns
  • Related Column Operations
  • Takeaways
  • 11. Filtering and Sorting Rows
  • Filtering Rows
  • Sorting Rows
  • Related Row Operations
  • Takeaways
  • 12. Working with Textual, Temporal, and Nested Data Types
  • String
  • Categorical
  • Enum
  • Temporal
  • List
  • Array
  • Struct
  • Takeaways
  • 13. Summarizing and Aggregating
  • Split, Apply, and Combine
  • GroupBy Context
  • The Descriptives
  • The Advanced
  • Aggregate Values to a List
  • Rename Aggregated Columns
  • Apply Multiple Aggregations At Once
  • Row-Wise Aggregations
  • Window Functions in Selection Context
  • Dynamic Grouping
  • Rolling Aggregations
  • Upsampling
  • Takeaways
  • 14. Joining and Concatenating
  • Joining
  • Inexact Joining
  • Vertical and Horizontal Concatenation
  • Takeaways
  • 15. Reshaping
  • Wide Versus Long DataFrames
  • Pivot to Wider DataFrame
  • Unpivot to Longer DataFrame
  • Transposing
  • Exploding
  • Partition into Multiple DataFrames
  • Takeaways
  • V. Advance
  • 16. Visualizing Data
  • NYC Bike Trips
  • Built-in Plotting with Altair
  • Pandas-like Plotting With hvPlot
  • Publication-Quality Graphics with Plotnine
  • Styling DataFrames With Great Tables
  • Takeaways
  • 17. Extending Polars
  • User Defined Functions in Python
  • Registering Your Own Namespace
  • Polars Plug-Ins in Rust
  • Takeaways
  • 18. Polars Internals
  • Polars’ Architecture
  • Arrow
  • Multi-Threaded Computations and SIMD Operations
  • The String Data Type in Memory
  • ChunkedArrays in Series
  • Query Optimization
  • Checking Your Expressions
  • Profiling Polars
  • Tests in Polars
  • Common Anti-patterns
  • Takeaways
  • Appendix A. Accelerating Polars with the GPU
  • Index