From f4555ea6032aab9e95af91f5611142fe2cafda90 Mon Sep 17 00:00:00 2001 From: javiber Date: Thu, 11 Apr 2024 10:53:18 -0300 Subject: [PATCH] Renamed from_indexed_dicts to from_struct --- docs/public_api_test.py | 2 +- docs/src/reference/temporian/io/from_struct.md | 0 temporian/__init__.py | 2 +- temporian/implementation/numpy/data/io.py | 6 +++--- temporian/implementation/numpy/data/test/io_test.py | 6 +++--- 5 files changed, 8 insertions(+), 8 deletions(-) create mode 100644 docs/src/reference/temporian/io/from_struct.md diff --git a/docs/public_api_test.py b/docs/public_api_test.py index 6cdd5c1e1..d1724a7d3 100644 --- a/docs/public_api_test.py +++ b/docs/public_api_test.py @@ -48,7 +48,7 @@ "to_tensorflow_dataset", "from_tensorflow_record", "to_tensorflow_record", - "from_indexed_dicts", + "from_struct", # DTYPES "float64", "float32", diff --git a/docs/src/reference/temporian/io/from_struct.md b/docs/src/reference/temporian/io/from_struct.md new file mode 100644 index 000000000..e69de29bb diff --git a/temporian/__init__.py b/temporian/__init__.py index a96277373..cbd5ad00a 100644 --- a/temporian/__init__.py +++ b/temporian/__init__.py @@ -58,7 +58,7 @@ # EventSets from temporian.implementation.numpy.data.event_set import EventSet, IndexData -from temporian.implementation.numpy.data.io import event_set, from_indexed_dicts +from temporian.implementation.numpy.data.io import event_set, from_struct # Serialization from temporian.core.serialization import save diff --git a/temporian/implementation/numpy/data/io.py b/temporian/implementation/numpy/data/io.py index f8ac6612a..170036d24 100644 --- a/temporian/implementation/numpy/data/io.py +++ b/temporian/implementation/numpy/data/io.py @@ -208,21 +208,21 @@ def event_set( @typecheck -def from_indexed_dicts( +def from_struct( data: List[Tuple[Dict[str, Any], Dict[str, DataArray]]], timestamps: str = "timestamp", is_unix_timestamp: bool = False, ) -> EventSet: """Creates an [`EventSet`][temporian.EventSet] from indexed data. - Unlike `event_set`, `from_indexed_dicts` expects for the data to be already + Unlike `event_set`, `from_struct` expects for the data to be already split by index value. Supported values for timestamps, indexes, and features as similar to `event_set`. Usage examples: ```python - >>> evset = tp.from_indexed_dicts( + >>> evset = tp.from_struct( ... [ ... ( ... {"i1": 1, "i2": "A"}, diff --git a/temporian/implementation/numpy/data/test/io_test.py b/temporian/implementation/numpy/data/test/io_test.py index 52a477bed..f7f8f417b 100644 --- a/temporian/implementation/numpy/data/test/io_test.py +++ b/temporian/implementation/numpy/data/test/io_test.py @@ -7,7 +7,7 @@ from numpy.testing import assert_array_equal from datetime import datetime -from temporian.implementation.numpy.data.io import event_set, from_indexed_dicts +from temporian.implementation.numpy.data.io import event_set, from_struct from temporian.implementation.numpy.data.event_set import IndexData, EventSet from temporian.core.data.schema import Schema from temporian.core.data.dtype import DType @@ -199,8 +199,8 @@ def test_feature_wrong_type(self): }, ) - def test_from_indexed_dicts(self): - evset = from_indexed_dicts( + def test_from_struct(self): + evset = from_struct( [ ( {"i1": 1, "i2": "A"},