WOLFRAM

Enable JavaScript to interact with content and submit forms on Wolfram websites. Learn how
Wolfram Language & System Documentation Center

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
Details and Options Details and Options
Examples  
Basic Examples  
Scope  
Properties & Relations  
See Also
Related Guides
History
Cite this Page

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 all

Basic Examples  (2)

Find the events nearest to a given day:

Wolfram Language code: eseries = EventSeries[Range[19], { DateObject[{2026, 2, 1}, "Day"], DateObject[{2026, 2, 28}, "Day"], "BusinessDay"}]
Wolfram Language code: EventSeriesLookup[eseries, DateObject[{2026, 2, 15}, "Day"]]

Find the next events:

Wolfram Language code: EventSeriesLookup[eseries, DateObject[{2026, 2, 15}, "Day"], "Next"]

Find the previous events:

Wolfram Language code: EventSeriesLookup[eseries, DateObject[{2026, 2, 15}, "Day"], "Previous"]

Find the event nearest to time 2:

Wolfram Language code: eseries = EventSeries[<||>, {{0, 1.2, 1.7, 2.1, 2.7, 3.5}}];
Wolfram Language code: EventSeriesLookup[eseries, 2, "Nearest"]

Find the timestamps of the four nearest events to time 2:

Wolfram Language code: EventSeriesLookup[eseries, 2, "Nearest" -> "Timestamp", 4]//Normal

Scope  (10)

Use EventSeriesLookup with different proximity types:

Wolfram Language code: eseries = EventSeries[{a, b, c, d}, {{0, 1, 2, 3}}]
Wolfram Language code: EventSeriesLookup[eseries, 1 / 2, "Previous"]
Wolfram Language code: EventSeriesLookup[eseries, 1 / 2, "Next"]
Wolfram Language code: EventSeriesLookup[eseries, 1 / 2, "Nearest"]

"Nearest" is the default:

Wolfram Language code: EventSeriesLookup[eseries, 1 / 2]

When two timestamps are equally close to the input time, both are included:

Wolfram Language code: eseries = EventSeries[{a, b, c, d, e}, {{0, 1, 2, 3, 4}}]
Wolfram Language code: EventSeriesLookup[eseries, 1.5]

EventSeriesLookup can return any number of events:

Wolfram Language code: eseries = EventSeries[{a, b, c, d, e, f}, {{0, 0, 1, 1, 1, 2}}]
Wolfram Language code: EventSeriesLookup[eseries, 1 / 3]
Wolfram Language code: EventSeriesLookup[eseries, 2 / 3]
Wolfram Language code: EventSeriesLookup[eseries, 1 / 2]

When an EventSeries has duplicate timestamps, all of the values for those timestamps are included by default:

Wolfram Language code: eseries = EventSeries[{a, b, c, d, e}, {{0, 0, 1, 1, 1}}]
Wolfram Language code: EventSeriesLookup[eseries, 2 / 3, "Next"]

Specify the maximum number of timestamps to be returned:

Wolfram Language code: EventSeriesLookup[eseries, 2 / 3, "Next", 2]

EventSeriesLookup with count n returns up to n results:

Wolfram Language code: eseries = EventSeries[Range[10], {RandomReal[1, 10]}]
Wolfram Language code: EventSeriesLookup[eseries, .3, "Previous", 15]

Use EventSeriesLookup with different properties:

Wolfram Language code: eseries = EventSeries[{a, b, c, d, e, f}, {{0, 0.1, 0.1, 0.3, 0.5, 0.5}}]
Wolfram Language code: EventSeriesLookup[eseries, .4, "Nearest" -> "Element"]
Wolfram Language code: EventSeriesLookup[eseries, .4, "Nearest" -> "Index"]
Wolfram Language code: EventSeriesLookup[eseries, .4, "Nearest" -> "Timestamp"]//Normal
Wolfram Language code: EventSeriesLookup[eseries, .4, "Nearest" -> "Value"]//Normal
Wolfram Language code: EventSeriesLookup[eseries, .4, "Nearest" -> "Distance"]//Normal
Wolfram Language code: EventSeriesLookup[eseries, .4, "Nearest" -> "EventSeries"]

Get the index of the proximal events:

Wolfram Language code: eseries = EventSeries[{a, b, c, d, e}, {{0, 0, 1, 1, 1}}]
Wolfram Language code: inds = EventSeriesLookup[eseries, .618, "Nearest" -> "Index"]

The result can be used with Part to get a new EventSeries :

Wolfram Language code: eseries[[inds]]
Wolfram Language code: Normal[%]

This is equivalent to the default result of EventSeriesLookup :

Wolfram Language code: EventSeriesLookup[eseries, .618, "Nearest"]

Take an event series with timestamps of granularity "Day":

Wolfram Language code: 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:

Wolfram Language code: june = DateObject[{2026, 6}, "Month"]; EventSeriesLookup[es, june]

Look up all the events immediately prior to June:

Wolfram Language code: EventSeriesLookup[es, june, "Previous"]

Return all the events after June in the form of EventSeries :

Wolfram Language code: EventSeriesLookup[es, june, "Next" -> "EventSeries", Infinity]

Take an event series of 250 elements:

Wolfram Language code: 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:

Wolfram Language code: 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:

Wolfram Language code: Normal[dist]

With a larger count, it is apparent that the proximal events are given in order of increasing distance:

Wolfram Language code: EventSeriesLookup[eseries, day, "Nearest" -> "Distance", 6] //Normal

The distances correspond to these timestamps:

Wolfram Language code: EventSeriesLookup[eseries, day, "Nearest" -> "Timestamp", 6] //Normal

Find all events within a week of the given day:

Wolfram Language code: BlockRandom[dates = RandomDate[100], RandomSeeding -> 1234]; es = EventSeries[Range[100], {dates}, DateGranularity -> "Day"]
Wolfram Language code: day = DateObject[{2026, 3, 15}];
Wolfram Language code: EventSeriesLookup[es, day, "Nearest", {Infinity, Quantity[1, "Weeks"]}]

Find only events in the week after the Ides of March:

Wolfram Language code: EventSeriesLookup[es, day, "Next", {Infinity, Quantity[1, "Weeks"]}]

Properties & Relations  (2)

EventSeriesLookup with the default ptype is equivalent to Nearest on the timestamps:

Wolfram Language code: 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}}]
Wolfram Language code: EventSeriesLookup[eseries, 2.5, "Nearest" -> "Timestamp"]//Normal
Wolfram Language code: Nearest[eseries["Timestamps"], 2.5]

EventSeriesLookup is faster because it uses the fact that the timestamps are sorted:

Wolfram Language code: BlockRandom[times = RandomInteger[10 ^ 6, 10 ^ 6], RandomSeeding -> 1234]; es = EventSeries[<||>, {times}];
Wolfram Language code: RepeatedTiming[EventSeriesLookup[es, 5 10 ^ 5, "Nearest" -> "Index"]]
Wolfram Language code: RepeatedTiming[Nearest[times -> "Index", 5 10 ^ 5]]

To get the same result, the times must be sorted:

Wolfram Language code: RepeatedTiming[Nearest[Sort[times] -> "Index", 5 10 ^ 5]]

Both EventSeriesLookup and TimeSeriesWindow can be used to extract a subseries:

Wolfram Language code: es = EventSeries[Range[20], {DateObject[{2026, 3, 25}]}]
Wolfram Language code: EventSeriesLookup[es, DateObject[{2026, 3, 31}], "Next" -> "EventSeries", Infinity]
Wolfram Language code: % === TimeSeriesWindow[es, {DateObject[{2026, 4, 1}], Automatic}]
Wolfram Research (2026), EventSeriesLookup, Wolfram Language function, https://reference.wolfram.com/language/ref/EventSeriesLookup.html.

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: 16-August-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: 16-August-2026]}

Top [フレーム]

AltStyle によって変換されたページ (->オリジナル) /