[docs]defisin(haystack:Array,needles:dak.Array|ak.Array,axis:int=-1)->Array:""" Find needles in haystack. This works by first transforming needles to an array with one more dimension than the haystack, placing the needles at axis, and then doing a comparison. Args: haystack (dak.Array or ak.Array): haystack of values. needles (dak.Array or ak.Array): one-dimensional set of needles to find in haystack. axis (int): the axis along which the comparison is performed Returns: dak.Array or ak.Array: result of comparison for needles in haystack """assertneedles.ndim==1,"Needles must be one-dimensional"assertaxis>=-1,"axis must be -1 or positive-valued"assertaxis<haystack.ndim+1,"axis too large for the haystack"# First, build up the transformation, with slice(None) indicating where to stick the needlesreshaper:list[None|slice]=[None]*haystack.ndimaxis=haystack.ndimifaxis==-1elseaxisreshaper.insert(axis,slice(None))# Note: reshaper needs to be a tuple for indexing purposesreturncast(Array,ak.any(haystack==needles[tuple(reshaper)],axis=-1))