Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/ruby/21.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/github/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ruby 在达鲁放大设置_Ruby_Daru - Fatal编程技术网

Ruby 在达鲁放大设置

Ruby 在达鲁放大设置,ruby,daru,Ruby,Daru,有没有什么办法可以放大?类似的东西。是的,你可以 对于Daru::Vector对象,请使用#push方法,如下所示: require 'daru' v = Daru::Vector.new([1,2,3], index: [:a,:b,:c]) v.push(23, :r) v #=> #<Daru::Vector:74005360 @name = nil @size = 4 > # nil # a 1 # b 2 # c 3 # r 23 您可

有没有什么办法可以放大?类似的东西。

是的,你可以

对于
Daru::Vector
对象,请使用
#push
方法,如下所示:

require 'daru'
v = Daru::Vector.new([1,2,3], index: [:a,:b,:c])
v.push(23, :r)
v
#=> 
#<Daru::Vector:74005360 @name = nil @size = 4 >
#    nil
#  a   1
#  b   2
#  c   3
#  r  23
您可以使用
DataFrame#row[]=
方法分配一行。例如,使用上一个数据帧
df

df.row[:a] = [23,35,2]
df
 #=> 
 #<Daru::DataFrame:73956870 @name = c8a65ffe-217d-43bb-b6f8-50d2530ec053  @size = 4>
 #                    a          b          r 
 #         0          1          5         11 
 #         1          2          6         22 
 #         2          3          7         33 
 #         a         23         35          2 
df.行[:a]=[23,35,2]
df
#=> 
#
#a b r
#         0          1          5         11 
#         1          2          6         22 
#         2          3          7         33 
#a 23352
分配
Daru::Vector
将根据
Daru::DataFrame
的向量名称对齐

您可以在中查看更多详细信息

希望这能回答你的问题

df.row[:a] = [23,35,2]
df
 #=> 
 #<Daru::DataFrame:73956870 @name = c8a65ffe-217d-43bb-b6f8-50d2530ec053  @size = 4>
 #                    a          b          r 
 #         0          1          5         11 
 #         1          2          6         22 
 #         2          3          7         33 
 #         a         23         35          2