home / github / issues

Menu
  • Search all tables
  • GraphQL API

issues: 1877642703

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
1877642703 I_kwDOAMm_X85v6o3P 8136 Type checking fails for DataArrayCoarsen methods 17516195 open 0     2 2023-09-01T15:38:27Z 2023-09-13T18:41:30Z   NONE      

What happened?

Pylance doesn't recognize method calls on DataArrayCoarsen such as .mean() or .sum()

For the code:

python da.coarsen().mean()

I get the following error squiggle:

Cannot access member "mean" for type "DataArrayCoarsen" Member "mean" is unknown Pylance (reportGeneralTypeIssues)

What did you expect to happen?

No response

Minimal Complete Verifiable Example

```Python import xarray as xr import numpy as np import pandas as pd

da = xr.DataArray( np.linspace(0, 364, num=364), dims="time", coords={"time": pd.date_range("1999-12-15", periods=364)}, )

da.coarsen(time=3, boundary="trim").mean() # ^^^^ Error squiggles here # Cannot access member "mean" for type "DataArrayCoarsen" ```

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

No response

Anything else we need to know?

Pylance version: v2023.8.50

Environment

INSTALLED VERSIONS ------------------ commit: None python: 3.11.4 (tags/v3.11.4:d2340ef, Jun 7 2023, 05:45:37) [MSC v.1934 64 bit (AMD64)] python-bits: 64 OS: Windows OS-release: 10 machine: AMD64 processor: Intel64 Family 6 Model 141 Stepping 1, GenuineIntel byteorder: little LC_ALL: None LANG: en_US.UTF-8 LOCALE: ('English_United States', '1252') libhdf5: None libnetcdf: None xarray: 2023.8.0 pandas: 2.1.0 numpy: 1.25.2 scipy: 1.11.1 netCDF4: None pydap: None h5netcdf: None h5py: None Nio: None zarr: None cftime: None nc_time_axis: None PseudoNetCDF: None iris: None bottleneck: None dask: 2023.8.1 distributed: None matplotlib: None cartopy: None seaborn: None numbagg: None fsspec: 2023.6.0 cupy: None pint: None sparse: None flox: None numpy_groupies: None setuptools: 61.0.0 pip: 22.0.4 conda: None pytest: None mypy: 1.5.1 IPython: 8.15.0 sphinx: None
{
    "url": "https://api.github.com/repos/pydata/xarray/issues/8136/reactions",
    "total_count": 2,
    "+1": 2,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
    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.548ms · About: xarray-datasette