Skip to content

Instantly share code, notes, and snippets.

@keitazoumana
Created September 12, 2022 20:46
Show Gist options
  • Save keitazoumana/2ea1f5d53a125655e8806b73392e7e6c to your computer and use it in GitHub Desktop.
Save keitazoumana/2ea1f5d53a125655e8806b73392e7e6c to your computer and use it in GitHub Desktop.
# Import pandas library
import pandas as pd
# Read my dataset
candidates_df = pd.read_csv("./data/candidates_data.csv")
# Check the data columns' types
candidates_df.dtypes
# Only select columns of type "object" & "datetime"
candidates_df.select_dtypes(include = ["object", "datetime64"])
# Exclude columns of type "datetime" & "int"
candidates_df.select_dtypes(exclude = ["int64", "datetime64"])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment