Currently, owing to the restriction due to automatic monkey-patching of daru-io modules into daru, the Importers are designed like this.
#! Usage from daru
df = Daru::DataFrame.read_csv(path, col_sep: ' ', other_opts)
#! is linked to daru-io like
inst = Daru::IO::Importers::CSV.read(path)
df = inst.call(col_sep: ' ', other_opts)
But, daru-io could use better set of arguments for methods, to ensure that a file is read only ONCE, and then called for dataframe with other options.
df = Daru::DataFrame.read_csv(path, col_sep: ' ', other_opts)
#! should rather be linked to daru-io like
inst = Daru::IO::Importers::CSV.read(path, col_sep: ' ')
df = inst.call(other_opts)
In general, all file parsing arguments and path should be provided in the read method, while post-reading arguments can be provided in call method.
Suggested by @zverok in PR #52
Currently, owing to the restriction due to automatic monkey-patching of daru-io modules into daru, the Importers are designed like this.
But, daru-io could use better set of arguments for methods, to ensure that a file is read only ONCE, and then called for dataframe with other options.
In general, all file parsing arguments and
path
should be provided in theread
method, while post-reading arguments can be provided incall
method.