Powered By GitBook
Series.dt.year
Obtain the year in a date time series
danfo.Series.dt.year() [source]
Parameters: None
Returns: Series (int elements)
Examples
Node
1
const dfd = require("danfojs-node")
2
3
let data = new dfd.date_range({"start":"2000-01-01", period:3, freq:"Y"})
4
let sf = new dfd.Series(data)
5
sf.print()
6
sf.dt.year().print()
Copied!
1
//print date time series
2
╔═══╤══════════════════════╗
3
║ 0 │ 1/1/2000, 1:00:00 AM ║
4
╟───┼──────────────────────╢
5
║ 1 │ 1/1/2001, 1:00:00 AM ║
6
╟───┼──────────────────────╢
7
║ 2 │ 1/1/2002, 1:00:00 AM ║
8
╚═══╧══════════════════════╝
9
10
╔═══╤══════╗
11
║ 0 │ 2000 ║
12
╟───┼──────╢
13
║ 1 │ 2001 ║
14
╟───┼──────╢
15
║ 2 │ 2002 ║
16
╚═══╧══════╝
Copied!
Last modified 24d ago
Copy link