Skip to content

Instantly share code, notes, and snippets.

@domitry
Created March 25, 2015 02:55
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 domitry/357b83e50566fe6e88cd to your computer and use it in GitHub Desktop.
Save domitry/357b83e50566fe6e88cd to your computer and use it in GitHub Desktop.
def replace_val(arr)
rule = {
hoge: [1, 2, 1],
nya: [2, 3, 4],
hoe: [1, 2, 3]
}
return arr.map{|label| rule[label]}
end
replace_val([:hoge, :nya, :nya, :hoe])
@domitry
Copy link
Author

domitry commented Mar 25, 2015

こういうのをnumpyで高速にやりたい

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment