MCPcopy Create free account
hub / github.com/huggingface/datasets / to_pylist

Method to_pylist

src/datasets/features/features.py:833–839  ·  view source on GitHub ↗
(self, maps_as_pydicts: Optional[Literal["lossy", "strict"]] = None)

Source from the content-addressed store, hash-verified

831 return numpy_arr
832
833 def to_pylist(self, maps_as_pydicts: Optional[Literal["lossy", "strict"]] = None):
834 zero_copy_only = _is_zero_copy_only(self.storage.type, unnest=True)
835 numpy_arr = self.to_numpy(zero_copy_only=zero_copy_only)
836 if self.type.shape[0] is None and numpy_arr.dtype == object:
837 return [arr.tolist() for arr in numpy_arr.tolist()]
838 else:
839 return numpy_arr.tolist()
840
841
842class PandasArrayExtensionDtype(PandasExtensionDtype):

Callers 14

cast_storageMethod · 0.45
cast_storageMethod · 0.45
cast_storageMethod · 0.45
embed_storageMethod · 0.45
embed_storageMethod · 0.45
embed_storageMethod · 0.45
embed_storageMethod · 0.45
cast_storageMethod · 0.45
embed_storageMethod · 0.45
embed_storageMethod · 0.45
_generate_examplesMethod · 0.45
_split_generatorsMethod · 0.45

Calls 2

to_numpyMethod · 0.95
_is_zero_copy_onlyFunction · 0.85

Tested by

no test coverage detected