SciRuby / daru

Data Analysis in RUby
BSD 2-Clause "Simplified" License
1.04k stars 140 forks source link

`add_vector` should not require name of named Vector. #510

Open kojix2 opened 5 years ago

kojix2 commented 5 years ago

EDIT (@v0dro): changing this issue to include only the add_vector part.

Vectors 's @name can be useful. But daru does not seem to use its features.

For example 

df = Daru::DataFrame.new(a: [1,2,3], b: [4,5,6])
v = df.a
df2 = Daru::DataFrame.new(c: [7,8,9], d: [10,11,12])
df2. add_vector "a", v

The vector knows its name, but the add_vector method requires the name of the vector.

(pseudocode)

df1 = DataFrame.new
v = df["some_vector"]
df2 = DataFrame
df2. add v

The expected behaviour should be that add_vector should pick up the name of the vector by itself.

v0dro commented 4 years ago

This can be separated into two issues:

  1. DataFrame cannot use the name value since it is an internal usage parameter.
  2. add_vector should have an option for not specifying the name of the vector if it already exists within the Vector.

About 1, it cannot be helped since we use the name internally but add_vector is a legit usecase I will amend your issue accordingly.