Open kojix2 opened 5 years ago
[]=
add_vector
does not specify the insertion location.
Can you please elaborate a bit this line?
This is good point.
we can add another column easily but then we have to order it. You can also do df[:player] = df.index
but yeah we should have a method to insert a column in specific place. may be we can have #insert
method having information about index of column, vector name and vector value.
That's exactly what I wanted to say.
Thanks for letting us know this usecase.
Hello @Shekharrajak , I would like to work on this one.
@cyrillefr , please go ahead. You can discuss your approach here once so that we can verify that you are going in right way then you can open a PR.
Hello @Shekharrajak , sorry for the little delay.
My idea is : add some new data at the end, then reorder.
The method would look like this:
def insert_vector n, name, source
vector = Daru::Vector.new(source, index: @index, name: @name)
@data << vector
@vectors = @vectors.add name
ordr = @vectors.dup.to_a
elmnt = ordr.pop
ordr = ordr.insert n, elmnt
self.order=ordr
end
Thanks @cyrillefr , please go ahead open a PR with few corner test cases. Love to see the changes in new release :)
Hello. Daru::DataFrame doesn't seem to have
insert
function.set_at
orset_row_at
will overwrite.[]=
add_vector
does not specify the insertion location.