towhee.functional.entity.EntityView

class towhee.functional.entity.EntityView(offset: int, table)[source]

Bases: object

The view to iterate DataFrames.

Parameters:

offset (int) – The offset of an Entity in the table.

Examples:

>>> from towhee import Entity, DataFrame
>>> e = [Entity(a=a, b=b) for a,b in zip(range(3), range(3))]
>>> df = DataFrame(e)
>>> df = df.to_column()
>>> df.to_list()[0]
<EntityView dict_keys(['a', 'b'])>
>>> df.to_list()[0].a
0
>>> df.to_list()[0].b
0

Methods

__init__(offset: int, table)[source]
__repr__()[source]

Define the representation of the EntityView.

Examples:

>>> from towhee import Entity, DataFrame
>>> e = [Entity(a=a, b=b) for a,b in zip(range(5), range(5))]
>>> df = DataFrame(e)
>>> df = df.to_column()
>>> df.to_list()[0]
<EntityView dict_keys(['a', 'b'])>
>>> df = DataFrame(e)
>>> df = df.set_chunksize(2)
>>> df.to_list()[0]
<EntityView dict_keys(['a', 'b'])>