Danfo.js
Getting Started
API Reference
Contributing Guide
Github
Search…
Danfo.js Documentation
Getting Started
API reference
General Functions
danfo.tensorflow
danfo. convertFunctionTotransformer
danfo.streamCsvTransformer
danfo.streamJSON
danfo.streamCSV
danfo.Utils
danfo.Str
danfo.Dt
danfo.dateRange
danfo.OneHotEncoder
danfo.StandardScaler
danfo.MinMaxScaler
danfo.LabelEncoder
danfo.toDateTime
danfo.getDummies
danfo.concat
danfo.merge
Input/Output
Series
Dataframe
Configuration Options
Plotting
Groupby
User Guides
Building Data Driven Applications with Danfo.js - Book
Contributing Guide
Release Notes
Powered By
GitBook
danfo.dateRange
Return a fixed frequency Dates spread between start and end parameters.
danfo.
dateRange
(options)
Parameters
Type
Description
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
Node
Browser
1
const
dfd
=
require
(
"danfojs-node"
)
2
3
let
data
=
new
dfd
.
dateRange
({
"start"
:
'1/1/2018'
,
period
:
5
,
freq
:
'M'
})
4
console
.
log
(
data
);
Copied!
1
<!
DOCTYPE
html
>
2
<
html
lang
=
"
en
"
>
3
4
<
head
>
5
<
meta
charset
=
"
UTF-8
"
>
6
<
meta
name
=
"
viewport
"
content
=
"
width=device-width, initial-scale=1.0
"
>
7
<!--danfojs CDN -->
8
<
script
src
=
"
https://cdn.jsdelivr.net/gh/opensource9ja/
[email protected]
/lib/bundle.js
"
>
</
script
>
9
<
title
>
Document
</
title
>
10
</
head
>
11
12
<
body
>
13
14
<
script
>
15
16
let
data
=
new
dfd
.
date_range
({
"start"
:
'1/1/2018'
,
period
:
5
,
freq
:
'M'
})
17
console
.
log
(
data
);
18
19
</
script
>
20
</
body
>
21
22
</
html
>
Copied!
Output
1
[
2
'1/1/2018, 12:00:00 AM',
3
'2/1/2018, 12:00:00 AM',
4
'3/1/2018, 12:00:00 AM',
5
'4/1/2018, 12:00:00 AM',
6
'5/1/2018, 12:00:00 AM'
7
]
Copied!
Node
Browser
1
const
dfd
=
require
(
"danfojs-node"
)
2
3
let
data
=
new
dfd
.
dateRange
({
"start"
:
'1/1/2018'
,
period
:
12
,
freq
:
'Y'
})
4
console
.
log
(
data
);
Copied!
1
Copied!
Output
1
[
2
'1/1/2018, 12:00:00 AM',
3
'1/1/2019, 12:00:00 AM',
4
'1/1/2020, 12:00:00 AM',
5
'1/1/2021, 12:00:00 AM',
6
'1/1/2022, 12:00:00 AM',
7
'1/1/2023, 12:00:00 AM',
8
'1/1/2024, 12:00:00 AM',
9
'1/1/2025, 12:00:00 AM',
10
'1/1/2026, 12:00:00 AM',
11
'1/1/2027, 12:00:00 AM',
12
'1/1/2028, 12:00:00 AM',
13
'1/1/2029, 12:00:00 AM'
14
]
Copied!
Datetime properties of Series or datetime-like columns in DataFrame can be accessed via accessors in the
dt
name space. See
Accessors
Previous
danfo.Dt
Next
danfo.OneHotEncoder
Last modified
3mo ago
Copy link
Contents
Examples