EventSeriesLookup[eseries,time]
gives the events in the EventSeries object eseries that are nearest to time.
EventSeriesLookup[eseries,time,ptype]
gives the events in eseries proximal with type ptype to time.
EventSeriesLookup[eseries,time,ptypeprop]
gives the property prop for the events proximal to time.
EventSeriesLookup[eseries,time,ptype,n]
gives up to n proximal events.
EventSeriesLookup[eseries,time,ptype,{n,r}]
gives up to n events within a maximal temporal distance r from time.
EventSeriesLookup
EventSeriesLookup[eseries,time]
gives the events in the EventSeries object eseries that are nearest to time.
EventSeriesLookup[eseries,time,ptype]
gives the events in eseries proximal with type ptype to time.
EventSeriesLookup[eseries,time,ptypeprop]
gives the property prop for the events proximal to time.
EventSeriesLookup[eseries,time,ptype,n]
gives up to n proximal events.
EventSeriesLookup[eseries,time,ptype,{n,r}]
gives up to n events within a maximal temporal distance r from time.
Details
- EventSeriesLookup is typically used to extract events that are temporally close to a particular time.
- EventSeriesLookup returns a list of pairs {timestamp,value} of the given event series. The output list can be empty.
- Possible values of time can be numbers or DateObject expressions.
- Possible proximity types ptype include:
-
"Nearest" events with timestamp closest to time "Previous" closest events before time "Next" closest events after time - EventSeriesLookup[eseries,time] is equivalent to EventSeriesLookup[eseries,time,"Nearest"].
- Possible properties prop include:
-
"Element" the proximal events {{t1,v1},…} "Index" the indices of the proximal events "Timestamps" the timestamps {t1,..} "Values" the values {v1,…} "Distance" the distances {t1-time,…} "EventSeries" an EventSeries of the proximal events - EventSeriesLookup[eseries,time,ptype] is equivalent to EventSeriesLookup[eseries,time,ptype"Element"].
- The radius r should be a number or a Quantity with time units.
Examples
open all close allBasic Examples (2)
Find the events nearest to a given day:
eseries = EventSeries[Range[19], { DateObject[{2026, 2, 1}, "Day"], DateObject[{2026, 2, 28}, "Day"], "BusinessDay"}]EventSeriesLookup[eseries, DateObject[{2026, 2, 15}, "Day"]]EventSeriesLookup[eseries, DateObject[{2026, 2, 15}, "Day"], "Next"]EventSeriesLookup[eseries, DateObject[{2026, 2, 15}, "Day"], "Previous"]Find the event nearest to time 2:
eseries = EventSeries[<||>, {{0, 1.2, 1.7, 2.1, 2.7, 3.5}}];EventSeriesLookup[eseries, 2, "Nearest"]Find the timestamps of the four nearest events to time 2:
EventSeriesLookup[eseries, 2, "Nearest" -> "Timestamp", 4]//NormalScope (10)
Use EventSeriesLookup with different proximity types:
eseries = EventSeries[{a, b, c, d}, {{0, 1, 2, 3}}]EventSeriesLookup[eseries, 1 / 2, "Previous"]EventSeriesLookup[eseries, 1 / 2, "Next"]EventSeriesLookup[eseries, 1 / 2, "Nearest"]EventSeriesLookup[eseries, 1 / 2]When two timestamps are equally close to the input time, both are included:
eseries = EventSeries[{a, b, c, d, e}, {{0, 1, 2, 3, 4}}]EventSeriesLookup[eseries, 1.5]EventSeriesLookup can return any number of events:
eseries = EventSeries[{a, b, c, d, e, f}, {{0, 0, 1, 1, 1, 2}}]EventSeriesLookup[eseries, 1 / 3]EventSeriesLookup[eseries, 2 / 3]EventSeriesLookup[eseries, 1 / 2]When an EventSeries has duplicate timestamps, all of the values for those timestamps are included by default:
eseries = EventSeries[{a, b, c, d, e}, {{0, 0, 1, 1, 1}}]EventSeriesLookup[eseries, 2 / 3, "Next"]Specify the maximum number of timestamps to be returned:
EventSeriesLookup[eseries, 2 / 3, "Next", 2]EventSeriesLookup with count n returns up to n results:
eseries = EventSeries[Range[10], {RandomReal[1, 10]}]EventSeriesLookup[eseries, .3, "Previous", 15]Use EventSeriesLookup with different properties:
eseries = EventSeries[{a, b, c, d, e, f}, {{0, 0.1, 0.1, 0.3, 0.5, 0.5}}]EventSeriesLookup[eseries, .4, "Nearest" -> "Element"]EventSeriesLookup[eseries, .4, "Nearest" -> "Index"]EventSeriesLookup[eseries, .4, "Nearest" -> "Timestamp"]//NormalEventSeriesLookup[eseries, .4, "Nearest" -> "Value"]//NormalEventSeriesLookup[eseries, .4, "Nearest" -> "Distance"]//NormalEventSeriesLookup[eseries, .4, "Nearest" -> "EventSeries"]Get the index of the proximal events:
eseries = EventSeries[{a, b, c, d, e}, {{0, 0, 1, 1, 1}}]inds = EventSeriesLookup[eseries, .618, "Nearest" -> "Index"]The result can be used with Part to get a new EventSeries:
eseries[[inds]]Normal[%]This is equivalent to the default result of EventSeriesLookup:
EventSeriesLookup[eseries, .618, "Nearest"]Take an event series with timestamps of granularity "Day":
BlockRandom[dates = RandomDate[100], RandomSeeding -> 1234];
es = EventSeries[Range[100], {dates}, DateGranularity -> "Day"]Look up all of the events for a time with a coarser granularity than that of the event series:
june = DateObject[{2026, 6}, "Month"];
EventSeriesLookup[es, june]Look up all the events immediately prior to June:
EventSeriesLookup[es, june, "Previous"]Return all the events after June in the form of EventSeries:
EventSeriesLookup[es, june, "Next" -> "EventSeries", Infinity]Take an event series of 250 elements:
BlockRandom[dates = RandomDate[250], RandomSeeding -> 1234];
eseries = EventSeries[Range[250], {dates}, DateGranularity -> "Day"]Look up all of the distances from the Ides of March to the nearest events:
day = DateObject[{2026, 3, 15}];
dist = EventSeriesLookup[eseries, day, "Nearest" -> "Distance"]The result has distance 0 repeated, since there are several instances of the Ides of March in the original event series:
Normal[dist]With a larger count, it is apparent that the proximal events are given in order of increasing distance:
EventSeriesLookup[eseries, day, "Nearest" -> "Distance", 6] //NormalThe distances correspond to these timestamps:
EventSeriesLookup[eseries, day, "Nearest" -> "Timestamp", 6] //NormalFind all events within a week of the given day:
BlockRandom[dates = RandomDate[100], RandomSeeding -> 1234];
es = EventSeries[Range[100], {dates}, DateGranularity -> "Day"]day = DateObject[{2026, 3, 15}];EventSeriesLookup[es, day, "Nearest", {Infinity, Quantity[1, "Weeks"]}]Find only events in the week after the Ides of March:
EventSeriesLookup[es, day, "Next", {Infinity, Quantity[1, "Weeks"]}]Properties & Relations (2)
EventSeriesLookup with the default ptype is equivalent to Nearest on the timestamps:
eseries = EventSeries[{Subscript[x, 1], Subscript[x, 2], Subscript[x, 3], Subscript[x, 4], Subscript[x, 5], Subscript[x, 6], Subscript[x, 7]}, {{1, 2, 2, 3, 3, 3, 4}}]EventSeriesLookup[eseries, 2.5, "Nearest" -> "Timestamp"]//NormalNearest[eseries["Timestamps"], 2.5]EventSeriesLookup is faster because it uses the fact that the timestamps are sorted:
BlockRandom[times = RandomInteger[10 ^ 6, 10 ^ 6], RandomSeeding -> 1234];
es = EventSeries[<||>, {times}];RepeatedTiming[EventSeriesLookup[es, 5 10 ^ 5, "Nearest" -> "Index"]]RepeatedTiming[Nearest[times -> "Index", 5 10 ^ 5]]To get the same result, the times must be sorted:
RepeatedTiming[Nearest[Sort[times] -> "Index", 5 10 ^ 5]]Both EventSeriesLookup and TimeSeriesWindow can be used to extract a subseries:
es = EventSeries[Range[20], {DateObject[{2026, 3, 25}]}]EventSeriesLookup[es, DateObject[{2026, 3, 31}], "Next" -> "EventSeries", Infinity]% === TimeSeriesWindow[es, {DateObject[{2026, 4, 1}], Automatic}]Related Guides
History
Text
Wolfram Research (2026), EventSeriesLookup, Wolfram Language function, https://reference.wolfram.com/language/ref/EventSeriesLookup.html.
CMS
Wolfram Language. 2026. "EventSeriesLookup." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/EventSeriesLookup.html.
APA
Wolfram Language. (2026). EventSeriesLookup. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/EventSeriesLookup.html
BibTeX
@misc{reference.wolfram_2026_eventserieslookup, author="Wolfram Research", title="{EventSeriesLookup}", year="2026", howpublished="\url{https://reference.wolfram.com/language/ref/EventSeriesLookup.html}", note=[Accessed: 12-June-2026]}
BibLaTeX
@online{reference.wolfram_2026_eventserieslookup, organization={Wolfram Research}, title={EventSeriesLookup}, year={2026}, url={https://reference.wolfram.com/language/ref/EventSeriesLookup.html}, note=[Accessed: 12-June-2026]}