From db8786c513eccedde7251799d715d7f3d2223a69 Mon Sep 17 00:00:00 2001 From: Pascal Bourgault Date: Mon, 2 Oct 2023 11:35:40 -0400 Subject: [PATCH] All single string in `coords` --- xscen/io.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/xscen/io.py b/xscen/io.py index 5bb876ae..87235767 100644 --- a/xscen/io.py +++ b/xscen/io.py @@ -552,7 +552,7 @@ def to_table( row: Union[None, str, Sequence[str]] = None, column: Union[None, str, Sequence[str]] = None, sheet: Union[None, str, Sequence[str]] = None, - coords: Union[bool, Sequence[str]] = True, + coords: Union[bool, str, Sequence[str]] = True, ) -> Union[pd.DataFrame, dict]: """Convert a dataset to a pandas DataFrame with support for multicolumns and multisheet. @@ -572,7 +572,7 @@ def to_table( Default is "variable", i.e. the name of the variable(s). sheet : str or sequence of str, optional Name of the dimension(s) to use as sheet names. - coords: bool or sequence of str + coords: bool or str or sequence of str A list of auxiliary coordinates to add to the columns (as would variables). If True, all (if any) are added. @@ -617,8 +617,8 @@ def _ensure_list(seq): f"Passed row, column and sheet do not match available dimensions. Got {needed_dims}, data has {da.dims}." ) - coords = coords or [] if coords is not True: + coords = _ensure_list(coords or []) drop = set(ds.coords.keys()) - set(da.dims) - set(coords) da = da.drop_vars(drop) else: