Message Boards Message Boards

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

How to insert a dataset inside another one?

Posted 7 months ago

I have the following two datasets:

Dataset[{
  <|"Date" -> DateObject[{2024, 1, 10}]|>,
  <|"Collection-area" -> Quantity[3, ("Centimeters")^2]|>,
  <|"Integration Time" -> Quantity[2.1, "Seconds"]|>
  }]

and

Dataset[{
  <|"\[Lambda]" -> Quantity[195.050, "Nanometers"], "r" -> Quantity[2.9, "Watts"]|>,
  <|"\[Lambda]" -> Quantity[196.000, "Nanometers"], "r" -> Quantity[2.1, "Watts"]|>,
  <|"\[Lambda]" -> Quantity[196.050, "Nanometers"], "r" -> Quantity[2.6, "Watts"]|>
  }]

How can I merge them into a new dataset that looks the following:

enter image description here

POSTED BY: Ehud Behar
3 Replies

To approximate the look you want, is this good enough?

Column[{d1, d2}, Alignment -> Center, Spacings -> 1, Frame -> True, 
 FrameStyle -> Gray]

Out[] = enter image description here

Otherwise, you can alternatively do this:

Dataset[{
    <|"Date" -> DateObject[{2024, 1, 10}]|>,
    <|"Collection-area" -> Quantity[3, ("Centimeters")^2]|>,
    <|"Integration Time" -> Quantity[2.1, "Seconds"]|>, 
    <|"\[Lambda],r" -> d2
    }]
POSTED BY: Carl Verdon
Posted 7 months ago

For your expected dataset, did you use actual code to create that, or is it just a graphic or some other "fake". If I could see the actual structure of that dataset, it would be easier. But anyway, in the meantime, this is close:

d1 = Dataset[{<|"Date" -> DateObject[{2024, 1, 10}]|>, 
              <|"Collection-area" -> Quantity[3, ("Centimeters")^2]|>, 
              <|"Integration Time" -> Quantity[2.1, "Seconds"]|>}];
d2 = Dataset[{<|"\[Lambda]" -> Quantity[195.050, "Nanometers"], "r" -> Quantity[2.9, "Watts"]|>, 
              <|"\[Lambda]" -> Quantity[196.000, "Nanometers"], "r" -> Quantity[2.1, "Watts"]|>, 
              <|"\[Lambda]" -> Quantity[196.050, "Nanometers"], "r" -> Quantity[2.6, "Watts"]|>}];
Dataset[Append[d1, Merge[d2, Dataset]]]
POSTED BY: Eric Rimbey
Posted 7 months ago

It is faked, with Microsoft Paint :Facepalming:

POSTED BY: Ehud Behar
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