Say I'm given a column "Date" with values that look like: 03/10/86, 06/10/86, 07/10/86, etc...
It is not as simple as doing Frame.indexRowsDate("Date")
.
My current solution is to create on the Excel 3 extra columns:
- Year
- Month
- Day
with values:
- =Year(A2)
- =Month(A2)
- =Day(A2)
(for row 2, where A is the column with the dates)
and then use this function:
let toDateTime (os:ObjectSeries<_>) =
let year = (os.Get "Year") :?> int)
let month = (os.Get "Month" :?> int)
let day = (os.Get "Day" :?> int)
DateTime(year,month,day)
Frame.indexRowsUsing toDateTime frame
Solution
Given the provided answer, the new toDateTime
looks like this:
let toDateTime (os:ObjectSeries<_>) =
DateTime.Parse((os.Get "Date") :?> string)