issues: 1827010471
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 |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1827010471 | I_kwDOAMm_X85s5fen | 8029 | ' ' at end of variable name causes to_netcdf() to crash | 18679628 | closed | 0 | 6 | 2023-07-28T19:48:53Z | 2023-08-14T16:15:40Z | 2023-08-14T16:15:40Z | NONE | What happened?If variable name ends in a ' ' (space) then to_netcdf crashes. In my opinion - At least the error message could tell which variable name has the issue - If space at the end is not allowed, then could you rstrip everything - It works with scipy xarr.to_netcdf(newName, engine="scipy") This is related to https://github.com/pydata/xarray/issues/7943 Our tool converts csv files to XARRAY. So these kind of errors need to self-heal, otherwise we have to feedback to the user and get them to change the csv file. Which would be frustrating for everyone What did you expect to happen?No response Minimal Complete Verifiable Example```Python with open('endSpace.csv','w') as f: f.write('''PASS ,temperature PASS, 10 FAIL, 20''') import pandas as pd df = pd.read_csv('endSpace.csv') index = ['temperature'] df = df.set_index(index) xarr = df.to_xarray() xarr.to_netcdf("new.nc") ``` MVCE confirmation
Relevant log output
Anything else we need to know?No response Environment
commit : 2e218d10984e9919f0296931d92ea851c6a6faf5
python : 3.11.2.final.0
python-bits : 64
OS : Darwin
OS-release : 22.5.0
Version : Darwin Kernel Version 22.5.0: Thu Jun 8 22:21:34 PDT 2023; root:xnu-8796.121.3~7/RELEASE_ARM64_T8112
machine : arm64
processor : arm
byteorder : little
LC_ALL : None
LANG : en_US.UTF-8
LOCALE : en_US.UTF-8
pandas : 1.5.3
numpy : 1.24.2
pytz : 2023.3
dateutil : 2.8.2
setuptools : 65.6.3
pip : 23.1.1
Cython : None
pytest : None
hypothesis : None
sphinx : None
blosc : None
feather : None
xlsxwriter : None
lxml.etree : None
html5lib : None
pymysql : None
psycopg2 : None
jinja2 : 3.1.2
IPython : None
pandas_datareader: None
bs4 : None
bottleneck : None
brotli : None
fastparquet : None
fsspec : 2023.3.0
gcsfs : None
matplotlib : None
numba : None
numexpr : None
odfpy : None
openpyxl : None
pandas_gbq : None
pyarrow : None
pyreadstat : None
pyxlsb : None
s3fs : None
scipy : 1.10.1
snappy : None
sqlalchemy : None
tables : None
tabulate : None
xarray : 2023.2.0
xlrd : None
xlwt : None
zstandard : None
tzdata : None
|
{ "url": "https://api.github.com/repos/pydata/xarray/issues/8029/reactions", "total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0 } |
completed | 13221727 | issue |