Created
July 30, 2020 07:15
-
-
Save ksdkamesh99/c1b950ef6f041ba8bc6d234bb0e98949 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Importing Required Libraries | |
import pandas as pd | |
import numpy as np | |
# Reading the dataset with column as Sex | |
data=pd.read_csv('train.csv',usecols=['Sex']) | |
# Change column name to Gender | |
data.columns=['gender'] | |
# We need to get dummies for the categorical data we have using get_dummies() | |
gender=pd.get_dummies(data) | |
#concatenating the dummies data frame with original dataframe by taking columns in the axis. | |
data=pd.concat([data,gender],axis=1) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment