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.
table – Which table stored in.
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
- __getattr__(name)[source]¶
Get the value of the entity.
- Parameters:
name (str) – The key string of the entity.
- Returns:
The value for that entity at the current offset.
- Return type:
Any
- __repr__()[source]¶
Define the representation of the EntityView.
- Returns (str):
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'])>