Autocomplete not working with xarray object

已回答

Hi, 

I installed pycharm with anaconda3 as the root (and the only) environment. Autocompletion works fine fine except for xarray and netcdf4 objects. Let me give an example. I read in a netcdf file like so: 

import xarray as xr

import netcdf4 as nc4

ds1 = xr.open_dataset('HadISST_sst.nc')

ds2 = nc4.Dataset('HadISST_sst.nc')

When I type ds1. or ds2. the objects' methods and attributes are not displayed. This happens only for xarray and netcdf4 objects. Autocomplete works well with objects of other types. 

I would appreciate any help, thanks!

  

0

I've created an issue about it: https://youtrack.jetbrains.com/issue/PY-26971 in PyCharm bug tracker, please follow it for updates. See https://intellij-support.jetbrains.com/hc/en-us/articles/207241135-How-to-follow-YouTrack-issues-and-receive-notifications if you are not familiar with YouTrack.

As a workaround you can add an explicit type hint:

ds1 = xr.open_dataset('HadISST_sst.nc') # type: Dataset
0

请先登录再写评论。