Create a Daru::Vector from a hash (timestamp: value) if the calulated offset does not fall onto one of the following time intervals than an error is raised
data = [DateTime.new(2020, 1, 1, 23, 58, 30), DateTime.new(2020, 1, 1, 23, 59, 00), DateTime.new(2020, 1, 1, 23, 59, 30)]
Daru::DateTimeIndexHelper.infer_offset(data)
# The offset here is calculated as being Rational(1, 2880)
# however you will get a NoMethodError
lib/ruby/gems/2.6.0/gems/daru-0.2.2/lib/daru/date_time/index.rb:97:in `infer_offset'
NoMethodError (undefined method `new' for nil:NilClass)
Why is this a problem? When passing a hash to Daru::Vector you cannot specify the index. It will be inferred...
Use case:
Create a Daru::Vector from a hash (timestamp: value) if the calulated offset does not fall onto one of the following time intervals than an error is raised
Code example showing the issue::
Why is this a problem? When passing a hash to Daru::Vector you cannot specify the index. It will be inferred...