Skip to content

Latest commit

 

History

History
45 lines (36 loc) · 1.1 KB

series.dt.year.md

File metadata and controls

45 lines (36 loc) · 1.1 KB
description
Obtain the year in a date time series

Series.dt.year

danfo.Series.dt.year()

Parameters: None

Returns: Series (int elements)

Examples

{% tabs %} {% tab title="Node" %}

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()

{% endtab %} {% endtabs %}

//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 ║
╚═══╧══════╝