Skip to content

Instantly share code, notes, and snippets.

@shinokada
Last active June 23, 2020 12:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save shinokada/720f2af25ef559aa5ea697a230ed47ed to your computer and use it in GitHub Desktop.
Save shinokada/720f2af25ef559aa5ea697a230ed47ed to your computer and use it in GitHub Desktop.
cols = [2,10,14]
rows = [33,36,39,42,45,48,51,57]
df =df.iloc[rows,cols].reset_index(drop=True)
df.columns=['race','Male','Female']
for col in ['Male', 'Female']:
df[col]=pd.to_numeric(df[col].str.replace('%',''))
display(df)
print(df.dtypes)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment