Preface 1. Preliminaries 1.1 What Is This Book About? What Kinds of Data? 1.2 Why Python for Data Analysis? Python as Glue Solving the “Two-Language” Problem Why Not Python? 1.3 Essential Python Libraries NumPy pandas matplotlib IPython and Jupyter SciPy scikit-learn statsmodels 1.4 Installation and Setup Windows Apple (OS X, macOS) GNU/Linux Installing or Updating Python Packages Python 2 and Python 3 Integrated Development Environments (IDEs) and Text Editors 1.5 Community and Conferences 1.6 Navigating This Book Code Examples Data for Examples Import Conventions Jargon 2. Python Language Basics, IPython, and Jupyter Notebooks 2.1 The Python Interpreter 2.2 IPython Basics Running the IPython Shell Running the Jupyter Notebook Tab Completion Introspection The %run Command Executing Code from the Clipboard Terminal Keyboard Shortcuts About Magic Commands Matplotlib Integration 2.3 Python Language Basics Language Semantics Scalar Types Control Flow 3. Built-in Data Structures, Functions, and Files 3.1 Data Structures and Sequences Tuple List Built-in Sequence Functions dict set List, Set, and Dict Comprehensions 3.2 Functions Namespaces, Scope, and Local Functions Returning Multiple Values Functions Are Objects Anonymous (Lambda) Functions Currying: Partial Argument Application Generators Errors and Exception Handling 3.3 Files and the Operating System Bytes and Unicode with Files 3.4 Conclusion 4. NumPy Basics: Arrays and Vectorized Computation 4.1 The NumPy ndarray: A Multidimensional Array Object 5. Getting Started with pandas. 6. Data Loading, Storage, and File Formats 7. Data Cleanincl and Preparation. 8. Data Wrangling: Join, Combine, and Reshape. 9. Plotting and Visualization. 10. Data Aggregation and Group Operations. 11. Time Series 12. Advanced pandas 13. Introduction to Modeling Libraries in Python 14. Data Analysis Examples A. Advanced NumPy. B. More on the IPython System