Skip to content

Instantly share code, notes, and snippets.

@suriyadeepan
Created November 30, 2020 14:02
Show Gist options
  • Save suriyadeepan/47c3fd09bc75a980ae655c4cefa0dc93 to your computer and use it in GitHub Desktop.
Save suriyadeepan/47c3fd09bc75a980ae655c4cefa0dc93 to your computer and use it in GitHub Desktop.
def create_feat_soil_type(df):
soil_type_cols = [ col for col in df.columns if 'Soil_Type' in col ]
soil_type = df[soil_type_cols].idxmax(axis=1)
return soil_type.apply(lambda x : int(x[9:]))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment