lenskit.data.EntitySet ====================== .. py:class:: lenskit.data.EntitySet(name, schema, vocabulary, table, _sel = None) :canonical: lenskit.data._entities.EntitySet Representation of a set of entities from the dataset. Obtained from :meth:`Dataset.entities`. Client code does not need to construct this class; obtain instances from a dataset's :meth:`~lenskit.data.Dataset.entities` method. .. py:attribute:: name :type: str The name of the entity class for these entities. .. py:attribute:: schema :type: lenskit.data.schema.EntitySchema .. py:attribute:: vocabulary :type: lenskit.data._vocab.Vocabulary The identifier vocabulary for this schema. .. py:property:: attributes :type: list[str] Get the attribute names for this entity class. .. py:method:: count() Return the number of entities in this entity set. .. py:method:: ids() Get the identifiers of the entities in this set. This is returned directly as PyArrow array instead of NumPy. .. py:method:: numbers() Get the numbers (from the vocabulary) for the entities in this set. .. py:method:: arrow() Get these entities and their attributes as a PyArrow table. .. py:method:: pandas() Get the entities and their attributes as a Pandas data frame. .. py:method:: attribute(name) Get values of an attribute for the entites in this entity set. .. py:method:: select(*, ids: lenskit.data.types.IDSequence | None = None) -> EntitySet select(*, numbers: numpy.ndarray[tuple[int], numpy.dtype[numpy.integer[Any]]] | pyarrow.IntegerArray[Any] | None = None) -> EntitySet Select a subset of the entities in this set. .. note:: The vocabulary is unchanged, so numbers in the resulting set will be entity numbers in the dataset's vocabulary. They are not rearranged to be relative to this entity set. :param ids: The entity identifiers to select. :param numbers: The entity numbers to select. :returns: The entity subset. .. py:method:: __len__()