Basic Data Types and Structures

Basic Pandas Data Types and Structures

Apart from basic data types such as integer, string, lists, etc, pandas library comes with some other crucial data structures such as series and dataframe. They will be used very frequently when working with data science projects using Python

Series

Series is a one-dimensional labeled array capable of holding data of any type (integer, string, float, python objects, etc). You can think of series as a column in a table. Series are:

  • Only contain homogeneous data (All the elements within series have to be of same data type)

  • Size Immutable (cannot be changed)

  • Values of Data Mutable (can be changed)

    Figure 21.1: Example of a Series

DataFrame

You can think of a DataFrame as almost like a spreadsheet table. It is to store data in tabular (rectangular) form, in rows and columns.

DataFrames can:

  • Contain Heterogeneous data

  • Have their size changed

Arithmetic operations can be performed on rows and columns.

The Basic Data structure script will walk you through a few examples of how to create and manipulate data using Series and DataFrame.