Selection, Filtering and Dropping

In this section, we will learn how to extract and remove a subset of rows and columns in pandas. The two primary operations of data extraction are:

  1. Selection: Extracting subset of columns.
  2. Filtering: Extracting subset of rows.

Let’s start by loading the dataset.

import pandas as pd 

url = "https://raw.githubusercontent.com/fahadsultan/csc272/main/data/elections.csv"

elections = pd.read_csv(url)