Message Boards Message Boards

0
|
1995 Views
|
2 Replies
|
0 Total Likes
View groups...
Share
Share this post:

How to select some date objects from a dataset which contains some values?

Posted 1 year ago

Hello, I have a data set which contains a date column that contains some values and data objects. I need to select some data objects but the values in that column stop me do that. For example:

test = Dataset[{<|"a" -> 2, "b" -> DateObject[{2022, 2}]|>, <|
    "a" -> 2, "b" -> DateObject[{2022, 2}]|>, <|"a" -> 2, "b" -> 0|>}]
test[Select[#"b" <= DateObject[{2022, 5}] &], All]

enter image description here How should I select data objects in this case?

POSTED BY: Zhenyu Zeng
2 Replies

How about this way:

test[Select[DateObjectQ[#b] && #b <= DateObject[{2022, 5}] &], All]
POSTED BY: Gustavo Delfino
Posted 1 year ago

Yes! Thanks a lot.

POSTED BY: Zhenyu Zeng
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