-
-
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
Dataset.to_netcdf with mixed int and str in data #2620
Comments
Thanks for the report! This is definitely a bug, we should be raising an informative error message here. It looks like these lines in Lines 119 to 139 in 778ffc4
|
Thank you very much shoyer, hope we can fix this bug in the next version. |
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 |
Hi,
The code below gives me a TypeError when use engine = ‘netcdf4’ or ‘scipy’ in to_netcdf() function, but works when use engine='h5netcdf' by automatically converting int to str.
Any good idea to solve this issue? To save the data as their original dtype (not covert int to str)?
Code:
df = pd.DataFrame({'a' : ['x', 'y'], 'b': [1,2]})
da = xr.DataArray(df)
ds = xr.Dataset({'test' : da})
ds.to_netcdf('test.nc', engine='netcdf4') #TypeError: expected bytes, int found
ds.to_netcdf('test.nc', engine='scipy') #TypeError: expected bytes, int found
ds.to_netcdf('test.nc', engine='h5netcdf') #works, but automatically covert int to str which is not good...
The text was updated successfully, but these errors were encountered: