Series.dt.year

Obtain the year in a date time series

danfo.Series.dt.year()

Parameters: None

Returns: Series (int elements)

Examples

const dfd = require("danfojs-node")

let data = new dfd.dateRange({"start":"2000-01-01", period:3, freq:"Y"})
let sf = new dfd.Series(data)
sf.print()
sf.dt.year().print()
//print date time series
╔═══╤══════════════════════╗
║ 0 │ 1/1/2000, 1:00:00 AM ║
╟───┼──────────────────────╢
║ 1 │ 1/1/2001, 1:00:00 AM ║
╟───┼──────────────────────╢
║ 2 │ 1/1/2002, 1:00:00 AM ║
╚═══╧══════════════════════╝

╔═══╤══════╗
║ 0 │ 2000 ║
╟───┼──────╢
║ 1 │ 2001 ║
╟───┼──────╢
║ 2 │ 2002 ║
╚═══╧══════╝

Last updated