2
$\begingroup$

I'm trying to select data from nested lists based on seconds.

This is my data:

data = {{"2020-08-16T13:00:22.5000000", 45.6332`, 
    0.75`}, {"2020-08-16T13:00:24.5000000", 45.6332`, 
    0.75`}, {"2020-08-16T13:00:26.5000000", 45.6332`, 
    0.75`}, {"2020-08-16T13:00:28.5000000", 45.6332`, 
    0.75`}, {"2020-08-16T13:00:30.5000000", 45.6332`, 0.75`}};

If i only wanted to select the list containing data from "2020-08-16T13:00:24*" for example, what is the best way of doing this?

I tried this but didnt work:

Select[data, First@Characters[First@#] == "2020-08-16T13:00:24*" &]

Thanks in advance.

$\endgroup$

1 Answer 1

6
$\begingroup$
Select[StringMatchQ["2020-08-16T13:00:24*"] @* First] @ data
{{"2020-08-16T13:00:24.5000000", 45.6332`, 0.75`}}
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.