home / github / issues

Menu
  • GraphQL API
  • Search all tables

issues: 595784008

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
595784008 MDU6SXNzdWU1OTU3ODQwMDg= 3945 Implement `value_counts` method 1200058 open 0     3 2020-04-07T11:05:06Z 2023-09-12T15:47:22Z   NONE      

Implement value_counts method

MCVE Code Sample

python print(object) <xarray.DataArray (subtissue: 49, sample: 532, gene_id: 31490)> dask.array<where, shape=(49, 532, 31490), dtype=object, chunksize=(1, 10, 31490), chunktype=numpy.ndarray> Coordinates: * gene_id (gene_id) object 'ENSG00000000003' ... 'ENSG00000285966' * sample (sample) object 'GTEX-1117F' 'GTEX-111CU' ... 'GTEX-ZZPU' * subtissue (subtissue) object 'Adipose - Subcutaneous' ... 'Whole Blood'

Suggested API:

object.value_count(**kwargs) should return an array with a new dimension defined by the kwargs key, containing the count values of all dimensions defined by the kwargs value.

Expected Output

python object.value_count(observation_counts=["subtissue", "sample"]) <xarray.DataArray (observation_counts: 3, gene_id: 31490)> dask.array<where, shape=(3, 31490), dtype=int, chunksize=(3, 31490), chunktype=numpy.ndarray> Coordinates: * gene_id (gene_id) object 'ENSG00000000003' ... 'ENSG00000285966' * observation_counts (observation_counts) object 'underexpressed' 'normal' 'overexpressed'

Problem Description

Currently there is no existing equivalent to this method that I know in xarray.

Versions

Output of `xr.show_versions()` INSTALLED VERSIONS ------------------ commit: None python: 3.7.6 | packaged by conda-forge | (default, Jan 7 2020, 22:33:48) [GCC 7.3.0] python-bits: 64 OS: Linux OS-release: 5.3.11-1.el7.elrepo.x86_64 machine: x86_64 processor: byteorder: little LC_ALL: None LANG: en_US.UTF-8 LOCALE: en_US.UTF-8 libhdf5: 1.10.5 libnetcdf: 4.7.3 xarray: 0.15.0 pandas: 1.0.0 numpy: 1.17.5 scipy: 1.4.1 netCDF4: 1.5.3 pydap: None h5netcdf: 0.7.4 h5py: 2.10.0 Nio: None zarr: 2.4.0 cftime: 1.0.4.2 nc_time_axis: None PseudoNetCDF: None rasterio: None cfgrib: None iris: None bottleneck: None dask: 2.10.1 distributed: 2.10.0 matplotlib: 3.1.3 cartopy: None seaborn: 0.10.0 numbagg: None setuptools: 45.1.0.post20200119 pip: 20.0.2 conda: None pytest: 5.3.5 IPython: 7.12.0 sphinx: 2.0.1
{
    "url": "https://api.github.com/repos/pydata/xarray/issues/3945/reactions",
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
    13221727 issue

Links from other tables

  • 1 row from issues_id in issues_labels
  • 3 rows from issue in issue_comments
Powered by Datasette · Queries took 0.511ms · About: xarray-datasette