Message Boards Message Boards

1
|
2063 Views
|
3 Replies
|
1 Total Likes
View groups...
Share
Share this post:

A problem with Dataset

Posted 1 year ago

Hi everybody!

I have to process data about fishing sessions and I want to investigate links between the number of fished individuals (trouts, for instance) and various environmental variables. It is necessary to select sub-datasets, depending on environmental characteristics ("Domaine", for instance) and of fishing strategies. An important variable is EC1 : the hunted species.

The beginning and the end of each session are known, and I need to complete the raw dataset by a supplementary column : End-Begin (discretized), say.
My code is :

Final = Lepoisson[
  All, <|#, 
    "Diff" -> 
     Ceiling[(AbsoluteTime@#"hcont" - 
         AbsoluteTime@#"hdeb") /(60 Pas)] |> &]

(see the joined notebook).

My problem is that, depending on the way data are selected, Final cannot be computed! What is wrong in the above instruction?

Thanks a lot!
Claude

POSTED BY: Claude Mante
3 Replies
Posted 1 year ago

Maybe I can reverse-engineer your question. Let's say we have,

TestDataset =
  Dataset[
    {<|"hcont" -> DateObject[{2022, 10, 14}], "hdeb" -> DateObject[{2022, 10, 13}]|>,
     <|"hcont" -> DateObject[{2022, 10, 12}], "hdeb" -> DateObject[{2022, 10, 11}]|>}]

I can apply a function to each of the rows, maybe something like this,

TestDataset[All, <|"hcont2" -> #hcont, "hdeb2" -> #hdeb, "diff" -> (#hcont - #hdeb)|> &]

enter image description here

Is that the kind of thing you're trying to do?

POSTED BY: Eric Rimbey

Thanks, Eric; in fact, it is merely a problem of missing data, not of date! I've been confused by the diagnosis of Mathematica:

Failure[DateObject, 
Association[
 "MessageTemplate" :> MessageName[DateObject, "str"], 
  "MessageParameters" -> {
HoldForm["hcont"], 
HoldForm[{"DateTimeShort"}]}]]
POSTED BY: Claude Mante
Posted 1 year ago

I would you suggest that you pare this down to a minimal example that demonstrates the exact place where you're having struggles. Like, maybe provide a one line expression that doesn't work as you expect along with the "correct" result that you're looking for. As it stands, it looks like I must first figure out all of your variables before I can even parse your question.

POSTED BY: Eric Rimbey
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract