Book Image

Learning pandas - Second Edition

By : Michael Heydt
Book Image

Learning pandas - Second Edition

By: Michael Heydt

Overview of this book

You will learn how to use pandas to perform data analysis in Python. You will start with an overview of data analysis and iteratively progress from modeling data, to accessing data from remote sources, performing numeric and statistical analysis, through indexing and performing aggregate analysis, and finally to visualizing statistical data and applying pandas to finance. With the knowledge you gain from this book, you will quickly learn pandas and how it can empower you in the exciting world of data manipulation, analysis and science.
Table of Contents (16 chapters)

Manipulating DataFrame Structure

pandas provides a powerful manipulation engine for you to use to explore your data. This exploration often involves making modifications to the structure of DataFrame objects to remove unnecessary data, change the format of existing data, or to create derived data from data in other rows or columns. These chapter will demonstrate how to perform these powerful and important operations.

Specifically, in this chapter we will cover:

  • Renaming columns
  • Adding new columns with [] and .insert()
  • Adding columns through enlargement
  • Adding columns using concatenation
  • Reordering columns
  • Replacing the contents of a column
  • Deleting columns
  • Adding new rows
  • Concatenating rows
  • Adding and replacing rows via enlargement
  • Removing rows using .drop()
  • Removing rows using Boolean selection
  • Removing rows using a slice