Skip to content

Instantly share code, notes, and snippets.

@cereniyim
Created April 29, 2020 11:59
Show Gist options
  • Save cereniyim/38cb1aa2973c17928e17e372065aeab0 to your computer and use it in GitHub Desktop.
Save cereniyim/38cb1aa2973c17928e17e372065aeab0 to your computer and use it in GitHub Desktop.
extract blend from variety function
def extract_blend_from_variety(variety):
# function to find if a variety is a blend
# ASSUMPTION: There is no NA values
# in the variety feature
if (variety.find("-") != -1) | (variety.find("Blend") != -1):
if variety == "Xarel-lo":
return 0
else:
return 1
else:
return 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment