From fcedc2d0dedcb916edf7ef5c1f4e869f0602ec6f Mon Sep 17 00:00:00 2001 From: Philippe THOMY Date: Thu, 9 May 2024 19:16:19 +0200 Subject: [PATCH 01/23] Update pandas.rst --- doc/user-guide/pandas.rst | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/doc/user-guide/pandas.rst b/doc/user-guide/pandas.rst index 76349fcd371..8c0d70a5184 100644 --- a/doc/user-guide/pandas.rst +++ b/doc/user-guide/pandas.rst @@ -110,6 +110,11 @@ work even if not the hierarchical index is not a full tensor product: s[::2] s[::2].to_xarray() +Lossless and reversible converter +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + + + Multi-dimensional data ~~~~~~~~~~~~~~~~~~~~~~ From 09d3e931f20bceb7d51246b5bf3f043569ed5914 Mon Sep 17 00:00:00 2001 From: Philippe THOMY Date: Fri, 10 May 2024 00:08:26 +0200 Subject: [PATCH 02/23] Update pandas.rst --- doc/user-guide/pandas.rst | 48 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) diff --git a/doc/user-guide/pandas.rst b/doc/user-guide/pandas.rst index 8c0d70a5184..0e44fd9160c 100644 --- a/doc/user-guide/pandas.rst +++ b/doc/user-guide/pandas.rst @@ -113,7 +113,55 @@ work even if not the hierarchical index is not a full tensor product: Lossless and reversible converter ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +The previous example shows that the conversion is not reversible (lossless roundtrip) and that the size of the ``datasets`` increases. +Another approach is to use a lossless and reversible conversion (e.g Third party `ntv-pandas`__ libraries). A dataset can then be shared +between several tools. + +__ https://github.com/loco-philippe/ntv-pandas/blob/main/README.md + +DataFrame to Dataset or DataArray +--------------------------------- + +The conversion is done without loss, by finding the multidimensional structure hidden by the tabular structure. + +By applying this conversion to the DataFame above, we find the initial ``Dataset``: + +.. ipython:: python + + df.npd.to_xarray() # ``npd`` is the ``ntv-pandas`` accessor + +Dataset or DataArray to Dataframe +--------------------------------- + +In the other direction, information that is not supported by the DataFrame must be transferred to the DataFrame (e.g. ``attrs`` data). + +For this, pandas provides the ``attrs`` attribute. + +.. ipython:: python + + ds = xr.Dataset( + {"foo": (("x", "y"), np.random.randn(2, 3))}, + coords={ + "x": [10, 20], + "y": ["a", "b", "c"], + "along_x": ("x", np.random.randn(2)), + "scalar": 123}, + attrs={"example": "test npd"} + ) + ds + +After reverse conversion, we find the initial ``Dataset``: + +.. ipython:: python + + df = npd.from_xarray(ds) + + df.npd.to_xarray() + +.. note:: + + The pandas ``attrs`` attribute is still experimental (some operations remove it). The associated information must therefore be processed as a priority Multi-dimensional data ~~~~~~~~~~~~~~~~~~~~~~ From 763e6d4af968b2876a5b454369491a72379a43f8 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Fri, 10 May 2024 08:07:39 +0000 Subject: [PATCH 03/23] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- doc/user-guide/pandas.rst | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/doc/user-guide/pandas.rst b/doc/user-guide/pandas.rst index 0e44fd9160c..f5983c7bc82 100644 --- a/doc/user-guide/pandas.rst +++ b/doc/user-guide/pandas.rst @@ -130,7 +130,7 @@ By applying this conversion to the DataFame above, we find the initial ``Dataset .. ipython:: python df.npd.to_xarray() # ``npd`` is the ``ntv-pandas`` accessor - + Dataset or DataArray to Dataframe --------------------------------- @@ -146,8 +146,9 @@ For this, pandas provides the ``attrs`` attribute. "x": [10, 20], "y": ["a", "b", "c"], "along_x": ("x", np.random.randn(2)), - "scalar": 123}, - attrs={"example": "test npd"} + "scalar": 123, + }, + attrs={"example": "test npd"}, ) ds From 6ca399d900e703b3f295376a49474e4719e323ec Mon Sep 17 00:00:00 2001 From: Philippe THOMY Date: Fri, 10 May 2024 10:25:06 +0200 Subject: [PATCH 04/23] Update pandas.rst --- doc/user-guide/pandas.rst | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/doc/user-guide/pandas.rst b/doc/user-guide/pandas.rst index 0e44fd9160c..11c862e5b36 100644 --- a/doc/user-guide/pandas.rst +++ b/doc/user-guide/pandas.rst @@ -129,8 +129,10 @@ By applying this conversion to the DataFame above, we find the initial ``Dataset .. ipython:: python - df.npd.to_xarray() # ``npd`` is the ``ntv-pandas`` accessor - + import ntv_pandas as npd + + df.npd.to_xarray() + Dataset or DataArray to Dataframe --------------------------------- From 878b68395f5ed1c73c1e8257ef78494e1c3c0ac0 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Fri, 10 May 2024 08:28:44 +0000 Subject: [PATCH 05/23] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- doc/user-guide/pandas.rst | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/doc/user-guide/pandas.rst b/doc/user-guide/pandas.rst index 11c862e5b36..1f46cd37bff 100644 --- a/doc/user-guide/pandas.rst +++ b/doc/user-guide/pandas.rst @@ -148,8 +148,9 @@ For this, pandas provides the ``attrs`` attribute. "x": [10, 20], "y": ["a", "b", "c"], "along_x": ("x", np.random.randn(2)), - "scalar": 123}, - attrs={"example": "test npd"} + "scalar": 123, + }, + attrs={"example": "test npd"}, ) ds From 56a488fbaf8f8045115578d2d1deb5e3b41c96b0 Mon Sep 17 00:00:00 2001 From: Philippe THOMY Date: Fri, 10 May 2024 23:04:46 +0200 Subject: [PATCH 06/23] Update ecosystem.rst --- doc/ecosystem.rst | 1 + 1 file changed, 1 insertion(+) diff --git a/doc/ecosystem.rst b/doc/ecosystem.rst index 076874d82f3..63f60cd0090 100644 --- a/doc/ecosystem.rst +++ b/doc/ecosystem.rst @@ -74,6 +74,7 @@ Extend xarray capabilities - `Collocate `_: Collocate xarray trajectories in arbitrary physical dimensions - `eofs `_: EOF analysis in Python. - `hypothesis-gufunc `_: Extension to hypothesis. Makes it easy to write unit tests with xarray objects as input. +- `ntv-pandas `_ : A tabular analyzer and a semantic, compact and reversible converter for multidimensional and tabular data - `nxarray `_: NeXus input/output capability for xarray. - `xarray-compare `_: xarray extension for data comparison. - `xarray-dataclasses `_: xarray extension for typed DataArray and Dataset creation. From c1a3ff5f1e7cceb7637f51ca415eb5026f233f1e Mon Sep 17 00:00:00 2001 From: Philippe THOMY Date: Mon, 13 May 2024 22:17:59 +0200 Subject: [PATCH 07/23] Update doc/user-guide/pandas.rst Co-authored-by: Mathias Hauser --- doc/user-guide/pandas.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/user-guide/pandas.rst b/doc/user-guide/pandas.rst index 1f46cd37bff..36b774477cc 100644 --- a/doc/user-guide/pandas.rst +++ b/doc/user-guide/pandas.rst @@ -113,7 +113,7 @@ work even if not the hierarchical index is not a full tensor product: Lossless and reversible converter ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -The previous example shows that the conversion is not reversible (lossless roundtrip) and that the size of the ``datasets`` increases. +The previous example shows that the conversion is not reversible (lossy roundtrip) and that the size of the ``datasets`` increases. Another approach is to use a lossless and reversible conversion (e.g Third party `ntv-pandas`__ libraries). A dataset can then be shared between several tools. From 84b476d8984541a3996baf977e323ff19460e876 Mon Sep 17 00:00:00 2001 From: Philippe THOMY Date: Mon, 13 May 2024 22:18:21 +0200 Subject: [PATCH 08/23] Update doc/user-guide/pandas.rst Co-authored-by: Mathias Hauser --- doc/user-guide/pandas.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/user-guide/pandas.rst b/doc/user-guide/pandas.rst index 36b774477cc..21aa76e3ea7 100644 --- a/doc/user-guide/pandas.rst +++ b/doc/user-guide/pandas.rst @@ -118,7 +118,7 @@ The previous example shows that the conversion is not reversible (lossy roundtri Another approach is to use a lossless and reversible conversion (e.g Third party `ntv-pandas`__ libraries). A dataset can then be shared between several tools. -__ https://github.com/loco-philippe/ntv-pandas/blob/main/README.md +__ https://github.com/loco-philippe/ntv-pandas DataFrame to Dataset or DataArray --------------------------------- From ffe3a7303c36b7b19cab53a83e88796c58a900de Mon Sep 17 00:00:00 2001 From: Philippe THOMY Date: Mon, 13 May 2024 22:20:25 +0200 Subject: [PATCH 09/23] Update doc/user-guide/pandas.rst Co-authored-by: Mathias Hauser --- doc/user-guide/pandas.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/user-guide/pandas.rst b/doc/user-guide/pandas.rst index 21aa76e3ea7..20a7ad21459 100644 --- a/doc/user-guide/pandas.rst +++ b/doc/user-guide/pandas.rst @@ -115,7 +115,7 @@ Lossless and reversible converter The previous example shows that the conversion is not reversible (lossy roundtrip) and that the size of the ``datasets`` increases. -Another approach is to use a lossless and reversible conversion (e.g Third party `ntv-pandas`__ libraries). A dataset can then be shared +Another approach is to use a lossless and reversible conversion (e.g with the third-party `ntv-pandas`__ library). A dataset can then be shared between several tools. __ https://github.com/loco-philippe/ntv-pandas From 5a6009ff8f12cac14e6a625326fd1fa5e158dfc9 Mon Sep 17 00:00:00 2001 From: Philippe THOMY Date: Mon, 13 May 2024 23:50:20 +0200 Subject: [PATCH 10/23] review comments --- ci/requirements/doc.yml | 1 + doc/user-guide/pandas.rst | 22 +++++++++++++++++----- 2 files changed, 18 insertions(+), 5 deletions(-) diff --git a/ci/requirements/doc.yml b/ci/requirements/doc.yml index 066d085ec53..23fe82d6c3a 100644 --- a/ci/requirements/doc.yml +++ b/ci/requirements/doc.yml @@ -20,6 +20,7 @@ dependencies: - matplotlib-base - nbsphinx - netcdf4>=1.5 + - ntv-pandas>=2.0.0 - numba - numpy>=1.21 - packaging>=21.3 diff --git a/doc/user-guide/pandas.rst b/doc/user-guide/pandas.rst index 20a7ad21459..431f5cb400f 100644 --- a/doc/user-guide/pandas.rst +++ b/doc/user-guide/pandas.rst @@ -125,18 +125,30 @@ DataFrame to Dataset or DataArray The conversion is done without loss, by finding the multidimensional structure hidden by the tabular structure. -By applying this conversion to the DataFame above, we find the initial ``Dataset``: +By applying this conversion to the DataFame above, we find the initial ``Dataset`` (the DataSet precursor to the DataFrame): .. ipython:: python import ntv_pandas as npd - df.npd.to_xarray() + ds_roundtrip = df.npd.to_xarray() + ds_roundtrip + +.. note:: + + A `dataset=True` or `dataset=False` parameter is used to choose the conversion result (active only if the Dataframe contains a single variable) Dataset or DataArray to Dataframe --------------------------------- -In the other direction, information that is not supported by the DataFrame must be transferred to the DataFrame (e.g. ``attrs`` data). +In the other direction, the ``DataFrame`` created (df_roundtrip) is equivalent to the initial ``DataFrame`` (df). + +.. ipython:: python + + df_roundtrip = npd.from_xarray(ds_roundtrip) + df_roundtrip + +To be lossless, the information that is not supported by the columns of the DataFrame (e.g. ``attrs`` data) must be transferred to the DataFrame. For this, pandas provides the ``attrs`` attribute. @@ -154,7 +166,7 @@ For this, pandas provides the ``attrs`` attribute. ) ds -After reverse conversion, we find the initial ``Dataset``: +After reverse conversion, ``attrs`` is still present in the ``Dataset``: .. ipython:: python @@ -164,7 +176,7 @@ After reverse conversion, we find the initial ``Dataset``: .. note:: - The pandas ``attrs`` attribute is still experimental (some operations remove it). The associated information must therefore be processed as a priority + The pandas ``attrs`` attribute is still experimental (some operations remove it). The associated information must therefore be processed as a priority. Multi-dimensional data ~~~~~~~~~~~~~~~~~~~~~~ From 1082288e6479607c94de6ab650a8742b2644af3b Mon Sep 17 00:00:00 2001 From: Philippe THOMY Date: Tue, 14 May 2024 00:13:34 +0200 Subject: [PATCH 11/23] Update doc.yml --- ci/requirements/doc.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ci/requirements/doc.yml b/ci/requirements/doc.yml index 23fe82d6c3a..2e79492dfb0 100644 --- a/ci/requirements/doc.yml +++ b/ci/requirements/doc.yml @@ -20,7 +20,7 @@ dependencies: - matplotlib-base - nbsphinx - netcdf4>=1.5 - - ntv-pandas>=2.0.0 + - ntv_pandas>=2.0.0 - numba - numpy>=1.21 - packaging>=21.3 From dd7970d10f8f945b4e706929aee95d838c74a43f Mon Sep 17 00:00:00 2001 From: Philippe THOMY Date: Tue, 14 May 2024 00:18:26 +0200 Subject: [PATCH 12/23] Update doc.yml --- ci/requirements/doc.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ci/requirements/doc.yml b/ci/requirements/doc.yml index 2e79492dfb0..23fe82d6c3a 100644 --- a/ci/requirements/doc.yml +++ b/ci/requirements/doc.yml @@ -20,7 +20,7 @@ dependencies: - matplotlib-base - nbsphinx - netcdf4>=1.5 - - ntv_pandas>=2.0.0 + - ntv-pandas>=2.0.0 - numba - numpy>=1.21 - packaging>=21.3 From 0113b968ef83b3e19e1e32ae63c443f202efc451 Mon Sep 17 00:00:00 2001 From: Philippe THOMY Date: Tue, 14 May 2024 08:56:33 +0200 Subject: [PATCH 13/23] Update doc.yml --- ci/requirements/doc.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ci/requirements/doc.yml b/ci/requirements/doc.yml index 23fe82d6c3a..ed4c37894a5 100644 --- a/ci/requirements/doc.yml +++ b/ci/requirements/doc.yml @@ -20,7 +20,6 @@ dependencies: - matplotlib-base - nbsphinx - netcdf4>=1.5 - - ntv-pandas>=2.0.0 - numba - numpy>=1.21 - packaging>=21.3 @@ -45,3 +44,4 @@ dependencies: - pip: # relative to this file. Needs to be editable to be accepted. - -e ../.. + - ntv-pandas>=2.0.0 From 5f9468a33ab7a7ac3d0d0d0d181a84e957d89289 Mon Sep 17 00:00:00 2001 From: Philippe THOMY Date: Tue, 14 May 2024 09:25:19 +0200 Subject: [PATCH 14/23] Update doc.yml --- ci/requirements/doc.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/ci/requirements/doc.yml b/ci/requirements/doc.yml index ed4c37894a5..c726bb132c1 100644 --- a/ci/requirements/doc.yml +++ b/ci/requirements/doc.yml @@ -45,3 +45,4 @@ dependencies: # relative to this file. Needs to be editable to be accepted. - -e ../.. - ntv-pandas>=2.0.0 + - python-tabulate From 77345bcc3395258bf5e722593af06901af4b9874 Mon Sep 17 00:00:00 2001 From: Philippe THOMY Date: Tue, 14 May 2024 09:43:54 +0200 Subject: [PATCH 15/23] Update doc.yml --- ci/requirements/doc.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ci/requirements/doc.yml b/ci/requirements/doc.yml index c726bb132c1..fc9ff824a02 100644 --- a/ci/requirements/doc.yml +++ b/ci/requirements/doc.yml @@ -45,4 +45,4 @@ dependencies: # relative to this file. Needs to be editable to be accepted. - -e ../.. - ntv-pandas>=2.0.0 - - python-tabulate + - python-tabulate>=0.9.0 From 06d98d33dc1c4c650c4b56818cc97a607a4102fa Mon Sep 17 00:00:00 2001 From: Philippe THOMY Date: Tue, 14 May 2024 09:49:29 +0200 Subject: [PATCH 16/23] Update doc.yml --- ci/requirements/doc.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ci/requirements/doc.yml b/ci/requirements/doc.yml index fc9ff824a02..55653a1f039 100644 --- a/ci/requirements/doc.yml +++ b/ci/requirements/doc.yml @@ -45,4 +45,4 @@ dependencies: # relative to this file. Needs to be editable to be accepted. - -e ../.. - ntv-pandas>=2.0.0 - - python-tabulate>=0.9.0 + - tabulate>=0.9.0 From 356f031ee040a784842ad9966897cd1eac67adac Mon Sep 17 00:00:00 2001 From: Philippe THOMY Date: Sun, 19 May 2024 23:36:44 +0200 Subject: [PATCH 17/23] remove code --- doc/user-guide/pandas.rst | 75 ++++++++------------------------------- 1 file changed, 15 insertions(+), 60 deletions(-) diff --git a/doc/user-guide/pandas.rst b/doc/user-guide/pandas.rst index 431f5cb400f..d7f79308101 100644 --- a/doc/user-guide/pandas.rst +++ b/doc/user-guide/pandas.rst @@ -110,73 +110,28 @@ work even if not the hierarchical index is not a full tensor product: s[::2] s[::2].to_xarray() -Lossless and reversible converter -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +Lossless and reversible conversion +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -The previous example shows that the conversion is not reversible (lossy roundtrip) and that the size of the ``datasets`` increases. +The previous ``Dataset`` example shows that the conversion is not reversible (lossy roundtrip) and +that the size of the ``Dataset`` increases. -Another approach is to use a lossless and reversible conversion (e.g with the third-party `ntv-pandas`__ library). A dataset can then be shared -between several tools. +Particularly after a roundtrip, the following deviations are noted: -__ https://github.com/loco-philippe/ntv-pandas - -DataFrame to Dataset or DataArray ---------------------------------- - -The conversion is done without loss, by finding the multidimensional structure hidden by the tabular structure. - -By applying this conversion to the DataFame above, we find the initial ``Dataset`` (the DataSet precursor to the DataFrame): - -.. ipython:: python - - import ntv_pandas as npd - - ds_roundtrip = df.npd.to_xarray() - ds_roundtrip - -.. note:: - - A `dataset=True` or `dataset=False` parameter is used to choose the conversion result (active only if the Dataframe contains a single variable) - -Dataset or DataArray to Dataframe ---------------------------------- - -In the other direction, the ``DataFrame`` created (df_roundtrip) is equivalent to the initial ``DataFrame`` (df). - -.. ipython:: python - - df_roundtrip = npd.from_xarray(ds_roundtrip) - df_roundtrip - -To be lossless, the information that is not supported by the columns of the DataFrame (e.g. ``attrs`` data) must be transferred to the DataFrame. - -For this, pandas provides the ``attrs`` attribute. +- a non-dimension Dataset ``coordinate`` is converted into ``variable`` +- a non-dimension DataArray ``coordinate`` is not converted +- ``dtype`` is not allways the same (e.g. "str" is converted to "object") +- ``attrs`` metadata is not converted -.. ipython:: python +To avoid these problems, the third-party `ntv-pandas`__ library offers lossless and reversible conversions between +``Dataset``/ ``DataArray`` and pandas ``DataFrame`` objects. - ds = xr.Dataset( - {"foo": (("x", "y"), np.random.randn(2, 3))}, - coords={ - "x": [10, 20], - "y": ["a", "b", "c"], - "along_x": ("x", np.random.randn(2)), - "scalar": 123, - }, - attrs={"example": "test npd"}, - ) - ds - -After reverse conversion, ``attrs`` is still present in the ``Dataset``: - -.. ipython:: python - - df = npd.from_xarray(ds) +This solution is particularly interesting for converting any ``DataFrame`` into a ``Dataset`` (the converter find the multidimensional structure hidden by the tabular structure). - df.npd.to_xarray() +The `ntv-pandas examples`__ show how to improve the conversion for the previous ``Dataset`` example and for more complex examples. -.. note:: - - The pandas ``attrs`` attribute is still experimental (some operations remove it). The associated information must therefore be processed as a priority. +__ https://github.com/loco-philippe/ntv-pandas +__ https://github.com/loco-philippe/ntv-pandas/tree/main/example Multi-dimensional data ~~~~~~~~~~~~~~~~~~~~~~ From f571bda6f23ce5282f842a5f0f29581a3e888ba7 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Sun, 19 May 2024 21:37:26 +0000 Subject: [PATCH 18/23] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- doc/user-guide/pandas.rst | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/doc/user-guide/pandas.rst b/doc/user-guide/pandas.rst index d7f79308101..1cd3ecf966b 100644 --- a/doc/user-guide/pandas.rst +++ b/doc/user-guide/pandas.rst @@ -118,12 +118,12 @@ that the size of the ``Dataset`` increases. Particularly after a roundtrip, the following deviations are noted: -- a non-dimension Dataset ``coordinate`` is converted into ``variable`` -- a non-dimension DataArray ``coordinate`` is not converted +- a non-dimension Dataset ``coordinate`` is converted into ``variable`` +- a non-dimension DataArray ``coordinate`` is not converted - ``dtype`` is not allways the same (e.g. "str" is converted to "object") - ``attrs`` metadata is not converted -To avoid these problems, the third-party `ntv-pandas`__ library offers lossless and reversible conversions between +To avoid these problems, the third-party `ntv-pandas`__ library offers lossless and reversible conversions between ``Dataset``/ ``DataArray`` and pandas ``DataFrame`` objects. This solution is particularly interesting for converting any ``DataFrame`` into a ``Dataset`` (the converter find the multidimensional structure hidden by the tabular structure). From a069c116c7af6f4be04737a141854b9cf37b18e0 Mon Sep 17 00:00:00 2001 From: Philippe THOMY Date: Tue, 21 May 2024 15:00:43 +0200 Subject: [PATCH 19/23] Update doc/user-guide/pandas.rst Co-authored-by: Mathias Hauser --- doc/user-guide/pandas.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/user-guide/pandas.rst b/doc/user-guide/pandas.rst index 1cd3ecf966b..b4236612273 100644 --- a/doc/user-guide/pandas.rst +++ b/doc/user-guide/pandas.rst @@ -121,7 +121,7 @@ Particularly after a roundtrip, the following deviations are noted: - a non-dimension Dataset ``coordinate`` is converted into ``variable`` - a non-dimension DataArray ``coordinate`` is not converted - ``dtype`` is not allways the same (e.g. "str" is converted to "object") -- ``attrs`` metadata is not converted +- ``attrs`` metadata is not conserved To avoid these problems, the third-party `ntv-pandas`__ library offers lossless and reversible conversions between ``Dataset``/ ``DataArray`` and pandas ``DataFrame`` objects. From e21402998a19cf7113cda8a91badca8fc146c9ce Mon Sep 17 00:00:00 2001 From: Philippe THOMY Date: Tue, 21 May 2024 15:02:31 +0200 Subject: [PATCH 20/23] Update doc/user-guide/pandas.rst Co-authored-by: Mathias Hauser --- doc/user-guide/pandas.rst | 3 --- 1 file changed, 3 deletions(-) diff --git a/doc/user-guide/pandas.rst b/doc/user-guide/pandas.rst index b4236612273..59da166944f 100644 --- a/doc/user-guide/pandas.rst +++ b/doc/user-guide/pandas.rst @@ -130,9 +130,6 @@ This solution is particularly interesting for converting any ``DataFrame`` into The `ntv-pandas examples`__ show how to improve the conversion for the previous ``Dataset`` example and for more complex examples. -__ https://github.com/loco-philippe/ntv-pandas -__ https://github.com/loco-philippe/ntv-pandas/tree/main/example - Multi-dimensional data ~~~~~~~~~~~~~~~~~~~~~~ From 4e8aede012a002acf6480424fc2f4621900df1ac Mon Sep 17 00:00:00 2001 From: Philippe THOMY Date: Tue, 21 May 2024 15:02:48 +0200 Subject: [PATCH 21/23] Update ci/requirements/doc.yml Co-authored-by: Mathias Hauser --- ci/requirements/doc.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/ci/requirements/doc.yml b/ci/requirements/doc.yml index 55653a1f039..066d085ec53 100644 --- a/ci/requirements/doc.yml +++ b/ci/requirements/doc.yml @@ -44,5 +44,3 @@ dependencies: - pip: # relative to this file. Needs to be editable to be accepted. - -e ../.. - - ntv-pandas>=2.0.0 - - tabulate>=0.9.0 From d8db8e9d6c2395949c82ba58678e4bc789775843 Mon Sep 17 00:00:00 2001 From: Philippe THOMY Date: Tue, 21 May 2024 15:03:35 +0200 Subject: [PATCH 22/23] Update doc/user-guide/pandas.rst Co-authored-by: Mathias Hauser --- doc/user-guide/pandas.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/user-guide/pandas.rst b/doc/user-guide/pandas.rst index 59da166944f..60b37e845c6 100644 --- a/doc/user-guide/pandas.rst +++ b/doc/user-guide/pandas.rst @@ -123,7 +123,7 @@ Particularly after a roundtrip, the following deviations are noted: - ``dtype`` is not allways the same (e.g. "str" is converted to "object") - ``attrs`` metadata is not conserved -To avoid these problems, the third-party `ntv-pandas`__ library offers lossless and reversible conversions between +To avoid these problems, the third-party `ntv-pandas `__ library offers lossless and reversible conversions between ``Dataset``/ ``DataArray`` and pandas ``DataFrame`` objects. This solution is particularly interesting for converting any ``DataFrame`` into a ``Dataset`` (the converter find the multidimensional structure hidden by the tabular structure). From 2b331dc1c281f08d8f6af368d319d95040133a65 Mon Sep 17 00:00:00 2001 From: Philippe THOMY Date: Tue, 21 May 2024 15:03:56 +0200 Subject: [PATCH 23/23] Update doc/user-guide/pandas.rst Co-authored-by: Mathias Hauser --- doc/user-guide/pandas.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/user-guide/pandas.rst b/doc/user-guide/pandas.rst index 60b37e845c6..26fa7ea5c0c 100644 --- a/doc/user-guide/pandas.rst +++ b/doc/user-guide/pandas.rst @@ -128,7 +128,7 @@ To avoid these problems, the third-party `ntv-pandas