danfo.dateRange

Return a fixed frequency Dates spread between start and end parameters.

danfo.dateRange(options)

ParametersTypeDescription

options

Object

Includes any of the following:

start: Left bound for generating dates.

end: Right bound for generating dates.

period : Number of periods to generate.

offSet: Date range offset

freq: Date range frequency. One of ["M","D","s","H","m","Y"]

Examples

const dfd = require("danfojs-node")

let data = new dfd.dateRange({"start":'1/1/2018', period:5, freq:'M'})
console.log(data);
[
  '1/1/2018, 12:00:00 AM',
  '2/1/2018, 12:00:00 AM',
  '3/1/2018, 12:00:00 AM',
  '4/1/2018, 12:00:00 AM',
  '5/1/2018, 12:00:00 AM'
]
const dfd = require("danfojs-node")

let data = new dfd.dateRange({ "start": '1/1/2018', period: 12, freq: 'Y' })
console.log(data);
[
  '1/1/2018, 12:00:00 AM',
  '1/1/2019, 12:00:00 AM',
  '1/1/2020, 12:00:00 AM',
  '1/1/2021, 12:00:00 AM',
  '1/1/2022, 12:00:00 AM',
  '1/1/2023, 12:00:00 AM',
  '1/1/2024, 12:00:00 AM',
  '1/1/2025, 12:00:00 AM',
  '1/1/2026, 12:00:00 AM',
  '1/1/2027, 12:00:00 AM',
  '1/1/2028, 12:00:00 AM',
  '1/1/2029, 12:00:00 AM'
]

Datetime properties of Series or datetime-like columns in DataFrame can be accessed via accessors in the dt name space. See Accessors

Last updated