From 1bfa1c41818b4e87e5567af2d49334efc545f53d Mon Sep 17 00:00:00 2001 From: Ryan Abernathey Date: Wed, 21 May 2025 15:11:07 -0400 Subject: [PATCH 1/2] Add copy keyword to to_dataframe --- xarray/core/dataset.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/xarray/core/dataset.py b/xarray/core/dataset.py index 5a7f757ba8a..e43d237f60e 100644 --- a/xarray/core/dataset.py +++ b/xarray/core/dataset.py @@ -7066,7 +7066,7 @@ def to_pandas(self) -> pd.Series | pd.DataFrame: "Please use Dataset.to_dataframe() instead." ) - def _to_dataframe(self, ordered_dims: Mapping[Any, int]): + def _to_dataframe(self, ordered_dims: Mapping[Any, int], copy: bool = True): from xarray.core.extension_array import PandasExtensionArray columns_in_order = [k for k in self.variables if k not in self.dims] @@ -7104,6 +7104,7 @@ def _to_dataframe(self, ordered_dims: Mapping[Any, int]): }, }, index=index, + copy=copy ) for extension_array_column in extension_array_columns_different_index: extension_array = self.variables[extension_array_column].data From c112ae0888c0a17c3c047caf3a5529f6b42c644a Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Wed, 21 May 2025 19:13:12 +0000 Subject: [PATCH 2/2] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- xarray/core/dataset.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xarray/core/dataset.py b/xarray/core/dataset.py index e43d237f60e..8d898d082ee 100644 --- a/xarray/core/dataset.py +++ b/xarray/core/dataset.py @@ -7104,7 +7104,7 @@ def _to_dataframe(self, ordered_dims: Mapping[Any, int], copy: bool = True): }, }, index=index, - copy=copy + copy=copy, ) for extension_array_column in extension_array_columns_different_index: extension_array = self.variables[extension_array_column].data pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy