#!/usr/bin/env python # coding: utf-8 # In[1]: import pandas as pd import numpy as np # In[2]: data = pd.read_csv("person_info.csv") # You can find the data here: https://github.com/lizhouf/oscr2019/blob/master/person_info.csv # In[3]: data # ## How to Check & Convert Data Types using Python? # ### Check Data Types # In python, we can use the .info() method to check the data information (note that "object" includes string data type): # In[4]: data.info() # ### Convert Data Type # If we want the class_of column to be all string types (i.e. dummy variables), we can: # In[6]: data.class_of = data.class_of.to_string() # We can see that, after these operations, the data type description of the class_of column is now changed to object. # In[7]: data.info()