fslaborg / Deedle

Easy to use .NET library for data and time series manipulation and for scientific programming
http://fslab.org/Deedle/
BSD 2-Clause "Simplified" License
929 stars 196 forks source link

tryLastValue will fail like lastValue #339

Closed casbby closed 5 years ago

casbby commented 8 years ago

The tryLastValue will fail like lastValue. This is misleading. What is the proper way to get the last value? If the value is missing and it is numerical can a Double.Nan be returned?


 [<CompiledName("GetLastValue")>]
  let lastValue (series:Series< 'K , 'V >) = series |> getAt (series.KeyCount-1) 

  /// Returns the last value of the series if one exists.
  /// [category:Accessing series data and lookup]
  [<CompiledName("TryGetLastValue")>]
  let tryLastValue (series:Series< 'K , 'V >) = 
    if series.KeyCount > 0 then series |> getAt (series.KeyCount-1) |> Some else None
tpetricek commented 8 years ago

Related: http://stackoverflow.com/questions/35268415/deedle-series-lastvalue-and-series-trylastvalue-both-fail-if-the-last-value-is-m/35270840#35270840

adamklein commented 8 years ago

Interesting. I don't think it's misleading, just ambiguous :) Ie, nothing better documentation couldn't fix. (Still think a cookbook would be awesome, sadly that requires time investment ...)

casbby commented 8 years ago

I am willing to help. I am a user of both pandas and Deedle. But my knowledge on Deedle is not adequate. If any of you guys can give me a hand I can give a go.

On 23 Feb 2016, at 00:59, Adam Klein notifications@github.com wrote:

Interesting. I don't think it's misleading, just ambiguous :) Ie, nothing better documentation couldn't fix. (Still think a cookbook would be awesome, sadly that requires time investment ...)

— Reply to this email directly or view it on GitHub.

adamklein commented 8 years ago

@tpetricek What do you think about trying to turn on github wiki feature for the deedle repo? Maybe we can use it to build a repository of examples.