chapter three
3 Series Methods
This chapter covers:
- Importing CSV datasets
- Sorting Series values in ascending and descending order
- Retrieving the largest and smallest values in a Series
- Mutating a Series inplace
- Counting occurrences of unique values in a Series
- Applying an operation to every value in a Series
In the previous chapter, we began our exploration of the Series object, a one-dimensional labelled array. We populated our Series from our own sources of data including lists, dictionaries, and NumPy's ndarray object. It's now time to dive into some diverse real-world datasets! There are three files for us to explore, all of which are stored in the CSV (Comma Separated Values) file format:
- pokemon.csv, an index of 800+ Pokémon, the popular Nintendo cartoon monsters that took the world by storm in the 1990s and now make up the highest grossing franchise of all time. Each Pokémon has one or more types such as Fire, Water, or Grass.
- google_stock.csv, a list of daily stock prices in US dollars for the technology company Google from its debut in August 2004 to October 2019
- revolutionary_war.csv, a record of battles during the American Revolutionary War. Each conflict is associated with a start date and a U.S. state. Because certain battles do not have a definitive start date or were not fought on U.S. territory, this data set contains missing / absent values.