def initialize data, opts={freq: nil}
      super data
      Helper.possibly_convert_to_date_time data

      @offset =
        case opts[:freq]
        when :infer then Helper.infer_offset(data)
        when  nil   then nil
        else  Helper.offset_from_frequency(opts[:freq])
        end

      @frequency = @offset ? @offset.freq_string : nil
      @data      = data.each_with_index.to_a.sort_by(&:first)

      @periods = data.size
    end
Create a DateTimeIndex with or without a frequency in data. The constructor
should be used for creating DateTimeIndex by directly passing in DateTime
objects or date-like strings, typically in cases where values with frequency
are not needed.

@param [Array<String>, Array<DateTime>] data Array of date-like Strings or
actual DateTime objects for creating the DateTimeIndex.
@param [Hash] opts Hash of options for configuring index.
@option opts [Symbol, NilClass, String, Daru::DateOffset, Daru::Offsets::*] freq
Option for specifying the frequency of data, if applicable. If `:infer` is
passed to this option, daru will try to infer the frequency of the data
by itself.

@example Usage of DateTimeIndex constructor
index = Daru::DateTimeIndex.new(
[DateTime.new(2012,4,5), DateTime.new(2012,4,6),
DateTime.new(2012,4,7), DateTime.new(2012,4,8)])
#=>#<DateTimeIndex:84232240 offset=nil periods=4 data=[2012-04-05T00:00:00+00:00...2012-04-08T00:00:00+00:00]>

index = Daru::DateTimeIndex.new([
DateTime.new(2012,4,5), DateTime.new(2012,4,6), DateTime.new(2012,4,7),
DateTime.new(2012,4,8), DateTime.new(2012,4,9), DateTime.new(2012,4,10),
DateTime.new(2012,4,11), DateTime.new(2012,4,12)], freq: :infer)
#=>#<DateTimeIndex:84198340 offset=D periods=8 data=[2012-04-05T00:00:00+00:00...2012-04-12T00:00:00+00:00]>