def percent_change periods=1
          must_be_numeric!

          prev = nil
          arr = @data.each_with_index.map do |cur, i|
            if i < periods ||
               include_with_nan?(Daru::MISSING_VALUES, cur) ||
               include_with_nan?(Daru::MISSING_VALUES, prev)
              nil
            else
              (cur - prev) / prev.to_f
            end.tap { prev = cur if cur }
          end

          Daru::Vector.new(arr, index: @index, name: @name)
        end
The percent_change method computes the percent change over
the given number of periods.

@param [Integer] periods (1) number of nils to insert at the beginning.

@example

vector = Daru::Vector.new([4,6,6,8,10],index: ['a','f','t','i','k'])
vector.percent_change
#=>
#   <Daru::Vector:28713060 @name = nil size: 5 >
#              nil
#   a
#   f	   0.5
#   t	   0.0
#   i	   0.3333333333333333
#   k          0.25