Exploring series and DataFrame objects
We'll start looking at pandas series and DataFrame objects. In this section, we'll start getting familiar with pandas series and DataFrames by looking at how they are created. We'll start with series since they are the building block of DataFrames. Series are one-dimensional array-like objects containing data of a single type. From this fact alone, you'd rightly conclude that they're very similar to one-dimensional NumPy arrays, but series have different methods than NumPy arrays that make them more ideal for managing data. They can be created with an index, which is metadata identifying the contents of the series. Series can handle missing data; they do so by representing missing data with NumPy's NaN.
Creating series
We can create series from array-like objects; these include lists, tuples, and NumPy ndarray
objects. We can also create a series from a Python dict. Another way to add an index to a series is to create one by passing either an index or...