我正在试图弄清楚如何为我的一个参数定义子参数。这就是我的工作:
v = pd.cut(df.measurement, bins=[17, 18, 19, 20], labels=['17-18', '18-19', '19-20'])
pd.get_dummies(v)
17-18 18-19 19-20
0 1 0 0
1 0 1 0
2 0 1 0
3 0 1 0
4 0 1 0
我想这样做:
require 'optparse'
options = {}
OptionParser.new do |parser|
parser.on("-r", "--require LIBRARY", "Require the LIBRARY before executing your script") do |lib|
parser.make_switch(["-p"], '--pop THING') do |o|
puts "You required #{o}!"
end
end
parser.on("-f", '--file FILE', 'File to be processed') do |file|
puts "This is the file: #{file}"
end
end.parse!
或
ruby myapp -r Library -p thing #<--required params