home / github / issues

Menu
  • Search all tables
  • GraphQL API

issues: 1775325545

This data as json

id node_id number title user state locked assignee milestone comments created_at updated_at closed_at author_association active_lock_reason draft pull_request body reactions performed_via_github_app state_reason repo type
1775325545 I_kwDOAMm_X85p0VFp 7943 '/' in variable name causes to_netcdf() to crash 18679628 closed 0     8 2023-06-26T18:17:18Z 2023-07-06T15:11:51Z 2023-07-06T15:11:51Z NONE      

What happened?

If variable name includes a '/' then to_netcdf crashes

What did you expect to happen?

No response

Minimal Complete Verifiable Example

```Python import pandas as pd df = pd.read_csv('slashCSV.csv') index = ['temperature'] df = df.set_index(index) xarr = df.to_xarray() xarr.to_netcdf("new.nc")

  • slashCSV.csv contents: PASS/FAIL,temperature PASS, 10 FAIL, 20 ```

MVCE confirmation

  • [X] Minimal example — the example is as focused as reasonably possible to demonstrate the underlying issue in xarray.
  • [X] Complete example — the example is self-contained, including all data and the text of any traceback.
  • [X] Verifiable example — the example copy & pastes into an IPython prompt or Binder notebook, returning the result.
  • [X] New issue — a search of GitHub Issues suggests this is not a duplicate.

Relevant log output

Python File "/opt/homebrew/lib/python3.11/site-packages/xarray/backends/netCDF4_.py", line 56, in __init__ array = self.get_array() ^^^^^^^^^^^^^^^^ File "/opt/homebrew/lib/python3.11/site-packages/xarray/backends/netCDF4_.py", line 83, in get_array variable = ds.variables[self.variable_name] ~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^ KeyError: 'PASS/FAIL'

Anything else we need to know?

No response

Environment

INSTALLED VERSIONS ------------------ commit: None python: 3.11.2 (main, Mar 24 2023, 00:16:47) [Clang 14.0.0 (clang-1400.0.29.202)] python-bits: 64 OS: Darwin OS-release: 22.5.0 machine: arm64 processor: arm byteorder: little LC_ALL: None LANG: en_US.UTF-8 LOCALE: ('en_US', 'UTF-8') libhdf5: 1.12.2 libnetcdf: 4.9.1 xarray: 2023.2.0 pandas: 1.5.3 numpy: 1.24.2 scipy: 1.10.1 netCDF4: 1.6.3 pydap: None h5netcdf: 1.1.0 h5py: 3.8.0 Nio: None zarr: 2.14.2 cftime: 1.6.2 nc_time_axis: None PseudoNetCDF: None rasterio: 1.3.6 cfgrib: 0.9.10.3 iris: None bottleneck: None dask: None distributed: None matplotlib: None cartopy: None seaborn: None numbagg: None fsspec: 2023.3.0 cupy: None pint: None sparse: None flox: None numpy_groupies: None setuptools: 65.6.3 pip: 23.1.1 conda: None pytest: None mypy: None IPython: None sphinx: None
{
    "url": "https://api.github.com/repos/pydata/xarray/issues/7943/reactions",
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  completed 13221727 issue

Links from other tables

  • 2 rows from issues_id in issues_labels
  • 0 rows from issue in issue_comments
Powered by Datasette · Queries took 0.801ms · About: xarray-datasette