'Construct a Filter indicating whether values are in ``choices``.
Parameters
choices : iterable[str or int]
An iterable of choices.
Returns
matches : Filter
Filter returning True for all sid/date pairs for which ``self``
produces an entry in ``choices``.'

def element_of(self, choices):

    try:
        choices = frozenset(choices)
    except Exception as e:
        raise TypeError('Expected    `choices`    to    be    an    iterable    of    hashable    values,    but    got    {}    instead.\nThis    caused    the    following    error:    {!r}.'.format(choices, e))
    if (self.missing_value in choices):
        raise ValueError('Found    self.missing_value    ({mv!r})    in    choices    supplied    to    {typename}.{meth_name}().\nMissing    values    have    NaN    semantics,    so    the    requested    comparison    would    always    produce    False.\nUse    the    isnull()    method    to    check    for    missing    values.\nReceived    choices    were    {choices}.'.format(mv=self.missing_value, typename=type(self).__name__, choices=sorted(choices), meth_name=self.element_of.__name__))
    def only_contains(type_, values):
        return all((isinstance(v, type_) for v in values))
    if (self.dtype == int64_dtype):
        if only_contains(int, choices):
            return ArrayPredicate(term=self, op=vectorized_is_element, opargs=(choices,))
        else:
            raise TypeError('Found    non-int    in    choices    for    {typename}.element_of.\nSupplied    choices    were    {choices}.'.format(typename=type(self).__name__, choices=choices))
    elif (self.dtype == categorical_dtype):
        if only_contains((bytes, unicode), choices):
            return ArrayPredicate(term=self, op=LabelArray.element_of, opargs=(choices,))
        else:
            raise TypeError('Found    non-string    in    choices    for    {typename}.element_of.\nSupplied    choices    were    {choices}.'.format(typename=type(self).__name__, choices=choices))
    assert False, ('Unknown    dtype    in    Classifier.element_of    %s.' % self.dtype)
