html_url,issue_url,id,node_id,user,created_at,updated_at,author_association,body,reactions,performed_via_github_app,issue https://github.com/pydata/xarray/issues/3955#issuecomment-610799451,https://api.github.com/repos/pydata/xarray/issues/3955,610799451,MDEyOklzc3VlQ29tbWVudDYxMDc5OTQ1MQ==,5821660,2020-04-08T07:31:26Z,2020-04-08T07:42:03Z,MEMBER,"There has been a lot of discussion about the int vs nan problem in the past, here one issue #1194. My question for xarray-devs would be too, if there is some idea on adapting to the pandas scheme? In the time being, you might just go the other way round (`isel` before `where`) and this little hack: ```python # overwrite fill_values with 0 sub = xr.where(z_indices == fill_value, 0, z_indices) # isel with sub and mask with where indexed_array = val_arr.isel(z=sub).where(z_indices != fill_value) ``` Update: Nevermind, this will make the `indexed_array` a float. You might use the same `where`-machinery and overwrite with a `fill_value ` of your liking: ```python # overwrite fill_values with 0 sub = xr.where(z_indices == fill_value, 0, z_indices) # isel with sub and mask with where indexed_array = val_arr.isel(z=sub) indexed_array = xr.where(z_indices == fill_value, fill_value, indexed_array) ``` I can't immediately see, but there might be a cleaner way to achieve this. ","{""total_count"": 1, ""+1"": 1, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,596352097