-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Formatting error in conjunction with pandas.DataFrame #2173
Comments
This is a manifestation of the same issue as #2172: you are using integers as dimension names, which we don't support very well. In this case, you end up with mixed integers/strings as dimension names, which means our internal use of |
In order to maintain a list of currently relevant issues, we mark issues as stale after a period of inactivity If this issue remains relevant, please comment here or remove the |
Closed by #2174 |
I can reproduce this on master so there's still more to do to fix this. Maybe we could try sorting using the |
This works: diff --git a/xarray/core/utils.py b/xarray/core/utils.py
index 1126cf30..355fb552 100644
--- a/xarray/core/utils.py
+++ b/xarray/core/utils.py
@@ -453,7 +453,7 @@ class SortedKeysDict(MutableMapping[K, V]):
del self.mapping[key]
def __iter__(self) -> Iterator[K]:
- return iter(sorted(self.mapping))
+ return iter(sorted(self.mapping, key=str))
def __len__(self) -> int:
return len(self.mapping) But maybe it is too naive? |
let's continue this in #5148 |
Code Sample, a copy-pastable example if possible
Problem description
Printing a xarray.Dataset results in an error when containing a pandas.DataFrame
Expected Output
Should print string representation of Dataset
Output of
xr.show_versions()
INSTALLED VERSIONS
commit: None
python: 3.6.5.final.0
python-bits: 64
OS: Linux
OS-release: 4.16.9-1-ARCH
machine: x86_64
processor:
byteorder: little
LC_ALL: None
LANG: de_DE.UTF-8
LOCALE: de_DE.UTF-8
xarray: 0.10.4
pandas: 0.22.0
numpy: 1.14.3
scipy: 1.0.1
netCDF4: None
h5netcdf: 0.5.1
h5py: 2.7.1
Nio: None
zarr: None
bottleneck: 1.2.1
cyordereddict: None
dask: None
distributed: None
matplotlib: 2.2.2
cartopy: None
seaborn: None
setuptools: 39.2.0
pip: 10.0.1
conda: None
pytest: None
IPython: 6.3.1
sphinx: None
The text was updated successfully, but these errors were encountered: