1

I need to compute the time derivative of a data column

dateformat yyyy-mm-dd HH:MM:SS.sss

1-d NDSparse with 40508 values (6 field named tuples):
Date
2019-03-01T02:46:44.658 
2019-03-01T02:46:44.811 
2019-03-01T02:46:45.119 
2019-03-01T02:46:45.222 
2019-03-01T02:46:47.579 
Bouarfa Mahi
  • 59
  • 1
  • 4

1 Answers1

0

These are likely already in a format you can use:

julia> using Dates

julia> t = parse(DateTime, "2019-03-01T02:46:44.658")
2019-03-01T02:46:44.658

So, as for the derivative, do you mean as in the algebraic derivative? You can get the milliseconds as an integer from the value:

julia> Int(t.instant.periods.value) 
63687091604658

and I suppose you could then get a correlation of some other part of your data with these time numbers and use that to get a sort of derivative, because you would be able to calculate a slope of the curve you fit to the time series. That would give you a change in your data per millisecond, if you did the correlation curve in that way. Is that what you want?

Bill
  • 5,600
  • 15
  • 27
  • Bill, just find that it is not possible to getindex in a ndsparse data structure. I am using now collect(t::DNDSparse) method. thanks. – Bouarfa Mahi Oct 11 '22 at 08:13
  • You comment regarding a feature that is not in your original question. Was your comment above intended for a different question? – Bill Oct 11 '22 at 19:00