{"id":13689238,"url":"https://github.com/Quansight-Labs/ndindex","last_synced_at":"2025-05-01T23:33:12.318Z","repository":{"id":37789372,"uuid":"246153717","full_name":"Quansight-Labs/ndindex","owner":"Quansight-Labs","description":"A Python library for manipulating indices of ndarrays ","archived":false,"fork":false,"pushed_at":"2024-10-09T10:51:47.000Z","size":9183,"stargazers_count":97,"open_issues_count":36,"forks_count":12,"subscribers_count":15,"default_branch":"main","last_synced_at":"2024-11-11T21:42:34.068Z","etag":null,"topics":["numpy","numpy-arrays","python"],"latest_commit_sha":null,"homepage":"https://quansight-labs.github.io/ndindex/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Quansight-Labs.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-03-09T22:20:06.000Z","updated_at":"2024-10-09T10:50:09.000Z","dependencies_parsed_at":"2024-02-15T17:59:39.623Z","dependency_job_id":"4092d165-bb08-4609-8b18-2feaf5955bde","html_url":"https://github.com/Quansight-Labs/ndindex","commit_stats":{"total_commits":1413,"total_committers":8,"mean_commits":176.625,"dds":0.01556970983722572,"last_synced_commit":"45558a010e2327b7a54e908494a6ca431b7d7271"},"previous_names":[],"tags_count":15,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Quansight-Labs%2Fndindex","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Quansight-Labs%2Fndindex/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Quansight-Labs%2Fndindex/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Quansight-Labs%2Fndindex/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Quansight-Labs","download_url":"https://codeload.github.com/Quansight-Labs/ndindex/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":224282190,"owners_count":17285786,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["numpy","numpy-arrays","python"],"created_at":"2024-08-02T15:01:39.583Z","updated_at":"2024-11-12T13:31:09.044Z","avatar_url":"https://github.com/Quansight-Labs.png","language":"Python","funding_links":[],"categories":["Python"],"sub_categories":[],"readme":"# ndindex\n\n![ndindex logo](docs/_static/ndindex_logo_white_bg.svg)\n\nA Python library for manipulating indices of ndarrays.\n\nThe documentation for ndindex can be found at https://quansight-labs.github.io/ndindex/\n\nndindex is a library that allows representing and manipulating objects that\ncan be valid indices to numpy arrays, i.e., slices, integers, ellipses,\nNone, integer and boolean arrays, and tuples thereof. The goals of the library\nare\n\n- Provide a uniform API to manipulate these objects. Unlike the standard index\n  objects themselves like `slice`, `int`, and `tuple`, which do not share any\n  methods in common related to being indices, ndindex classes can all be\n  manipulated uniformly. For example, `idx.args` always gives the arguments\n  used to construct `idx`.\n\n- Give 100% correct semantics as defined by numpy's ndarray. This means that\n  ndindex will not make a transformation on an index object unless it is\n  correct for all possible input array shapes. The only exception to this rule\n  is that ndindex assumes that any given index will not raise IndexError (for\n  instance, from an out of bounds integer index or from too few dimensions).\n  For those operations where the array shape is known, there is a `reduce()`\n  method to reduce an index to a simpler index that is equivalent for the\n  given shape.\n\n- Enable useful transformation and manipulation functions on index objects.\n\n## Examples\n\n**Canonicalize a slice (over a given shape, or independent of array shape)**\n\n\n```py\n\u003e\u003e\u003e from ndindex import *\n\u003e\u003e\u003e Slice(-2, 10, 3).reduce()\nSlice(-2, 10, 2)\n\u003e\u003e\u003e Slice(-2, 10, 3).reduce(5)\nSlice(3, 4, 1)\n```\n\n**Compute the maximum length of a sliced axis**\n\n\n```py\n\u003e\u003e\u003e import numpy as np\n\u003e\u003e\u003e len(Slice(2, 10, 3))\n3\n\u003e\u003e\u003e len(np.arange(10)[2:10:3])\n3\n```\n\n**Compute the shape of an array of shape `(10, 20)` indexed by `[0, 0:10]`**\n\n```py\n\u003e\u003e\u003e Tuple(0, slice(0, 10)).newshape((10, 20))\n(10,)\n\u003e\u003e\u003e np.ones((10, 20))[0, 0:10].shape\n(10,)\n```\n\n**Check if an indexed array would be empty**\n\n```py\n\u003e\u003e\u003e Tuple(0, ..., Slice(10, 20)).isempty((3, 4, 5))\nTrue\n\u003e\u003e\u003e np.ones((3, 4, 5))[0,...,10:20]\narray([], shape=(4, 0), dtype=float64)\n```\n\nSee the [documentation](https://quansight-labs.github.io/ndindex/) for full details\non what ndindex can do.\n\n## License\n\n[MIT License](LICENSE)\n\n## Acknowledgments\n\nndindex development is supported by [Quansight\nLabs](https://labs.quansight.org/) and is sponsored in part by [the D. E.\nShaw group](https://www.deshaw.com/). The D. E. Shaw group collaborates with\nQuansight on numerous open source projects, including Numba, Dask and Project\nJupyter.\n\n\u003cp align=\"center\"\u003e\n\u003ca href=\"https://labs.quansight.org/\"\u003e\u003cimg src=\"https://labs.quansight.org/images/QuansightLabs_logo_V2.png\" alt=\"https://labs.quansight.org/\"\nwidth=\"200\"\u003e\u003c/a\u003e\n\u003ca href=\"https://www.deshaw.com\"\u003e\u003cimg src=\"https://www.deshaw.com/assets/logos/blue_logo_417x125.png\" alt=\"https://www.deshaw.com\"\nwidth=\"200\"\u003e\u003c/a\u003e\n\u003c/p\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FQuansight-Labs%2Fndindex","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FQuansight-Labs%2Fndindex","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FQuansight-Labs%2Fndindex/lists"}