Last active
January 1, 2022 16:03
-
-
Save youssefHosni/a3d20320066a53dff3fec2ffc7b253f3 to your computer and use it in GitHub Desktop.
Machine learning end to end flow
This file contains 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
important_features_index=[9,14,17,20,692,699,700,701,702,703,704,705,1368,1370,1371,1410,1411] | |
important_features_index=[x-2 for x in important_features_index] | |
demographics_data=demographics_data.iloc[important_features_index,:] | |
demographics_data=demographics_data.set_index('Attribute') | |
demographics_data=demographics_data.transpose() | |
new_columns_name=['Total population' ,'age 15-24','age 25-34','age 35-44','people with income','20-30 thousand','30-40 thousand','40-50 thousand','50-60 thousand','60-80 thousand','80-90 thousand','100 thousand and more','Total population over 15 for education','High school diploma or equivalent','Postsecondary certificate, diploma or degree','In the labour force','Employed'] | |
demographics_data.columns=new_columns_name | |
demographics_data=demographics_data.reset_index(drop=False) | |
demographics_data.rename(columns={'index':'Neighborhood'},inplace=True) | |
demographics_data.drop(index=[0,1,2],axis=1,inplace=True) | |
demographics_data.reset_index(drop=True,inplace=True) | |
# calcaulating the number of 15-45 population and change the name of the columns | |
demographics_data['number of educated people']=(demographics_data['High school diploma or equivalent']+demographics_data['Postsecondary certificate, diploma or degree']) | |
demographics_data['number of 15-45']=(demographics_data['age 15-24']+demographics_data['age 25-34']+demographics_data['age 35-44']) | |
demographics_data['number of employers']=demographics_data['Employed'] | |
demographics_data.drop(columns=new_columns_name[1:],axis=1,inplace=True) | |
demographics_data.sort_values(by='Neighborhood') | |
demographics_data.head() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment