SciRuby / daru

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

DataFrame's indifferent acces #229

Open genya0407 opened 8 years ago

genya0407 commented 8 years ago

It might be more user-friendly if Daru::DataFrame supports Hash's indifferent access.

For example:

Daru::DataFrame.new(:A => [:a, :b, :c, :d]).concat(
  Daru::DataFrame.new('A' => [:e, :f, :g, :h])
)

Above code results in DataFrame like below: untitled

This behavior is a bit confusing. By introducing something like ActiveSupport's HashWithIndifferentAccess (or providing options to enable this feature), Daru might become more user-friendly.

I want to hear your opinions 😸

v0dro commented 8 years ago

It's too much overhead for daru to store everything as a string or symbol and then access it. It's more simple and straightforward to have the user take care of such things. Also, index names can be numbers, strings, symbols or arbitrary Ruby objects. How do we handle all of this without introducing overhead?

genya0407 commented 8 years ago

I got it.