{"database": "github", "table": "issue_comments", "is_view": false, "human_description_en": "where author_association = \"MEMBER\", issue = 626625818 and user = 14808389 sorted by updated_at descending", "rows": [["https://github.com/pydata/xarray/pull/4108#issuecomment-761907785", "https://api.github.com/repos/pydata/xarray/issues/4108", 761907785, "MDEyOklzc3VlQ29tbWVudDc2MTkwNzc4NQ==", 14808389, "2021-01-18T00:22:57Z", "2021-01-18T00:23:50Z", "MEMBER", "I wonder if it would be better to first \"reorganize\" all of the existing functions: we currently have `rename` (and `Dataset.rename_dims` / `Dataset.rename_vars`), `set_coords`, `reset_coords`, `set_index`, `reset_index` and `swap_dims`, which overlap partially. For example, the code sample from #4417 works if instead of\r\n```python\r\nds = ds.rename(b='x')\r\nds = ds.set_coords('x')\r\n```\r\nwe use\r\n```python\r\nds = ds.set_index(x=\"b\")\r\n```\r\nand something similar for the code sample in #4107.\r\n\r\nI believe we currently have these use cases (not sure if that list is complete, though):\r\n- rename a `DataArray` \u2192 `rename`\r\n- rename a existing variable to a name that is not yet in the object \u2192 `rename` / `Dataset.rename_vars` / `Dataset.rename_dirs`\r\n- convert a data variable to a coordinate (not a dimension coordinate) \u2192 `set_coords`\r\n- convert a coordinate (not a dimension coordinate) to a data variable \u2192 `reset_coords`\r\n- swap a existing dimension coordinate with a coordinate (which may not exist) and rename the dimension \u2192 `swap_dims`\r\n- use a existing coordinate / data variable as a dimension coordinate (do not rename the dimension) \u2192 `set_index`\r\n- stop using a coordinate as dimension coordinate and append `_` to its name (do not rename the dimension) \u2192 `reset_index`\r\n- use two existing coordinates / data variables as a MultiIndex \u2192 `set_index`\r\n- stop using a MultiIndex as a dimension coordinate and use its levels as coordinates \u2192 `reset_index`\r\n\r\nSometimes, some of these can be emulated by combinations of others, for example:\r\n```python\r\n# x is a dimension without coordinates\r\nassert_identical(ds.set_index({\"x\": \"b\"}), ds.swap_dims({\"x\": \"b\"}).rename({\"b\": \"x\"}))\r\nassert_identical(ds.swap_dims({\"x\": \"b\"}), ds.set_index({\"x\": \"b\"}).rename({\"x\": \"b\"}))\r\n```\r\nand, with this PR:\r\n```python\r\nassert_identical(ds.set_index({\"x\": \"b\"}), ds.set_coords(\"b\").rename({\"b\": \"x\"}))\r\nassert_identical(ds.swap_dims({\"x\": \"b\"}), ds.rename({\"b\": \"x\"}))\r\n```\r\nwhich means that it would increase the overlap of `rename`, `set_index`, and `swap_dims`.\r\n\r\nIn any case I think we should add a guide which explains which method to pick in which situation (or extend `howdoi`).", "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", null, 626625818]], "truncated": false, "filtered_table_rows_count": 1, "expanded_columns": [], "expandable_columns": [[{"column": "issue", "other_table": "issues", "other_column": "id"}, "title"], [{"column": "user", "other_table": "users", "other_column": "id"}, "login"]], "columns": ["html_url", "issue_url", "id", "node_id", "user", "created_at", "updated_at", "author_association", "body", "reactions", "performed_via_github_app", "issue"], "primary_keys": ["id"], "units": {}, "query": {"sql": "select html_url, issue_url, id, node_id, user, created_at, updated_at, author_association, body, reactions, performed_via_github_app, issue from issue_comments where \"author_association\" = :p0 and \"issue\" = :p1 and \"user\" = :p2 order by updated_at desc limit 101", "params": {"p0": "MEMBER", "p1": "626625818", "p2": "14808389"}}, "facet_results": {"author_association": {"name": "author_association", "type": "column", "hideable": false, "toggle_url": "/github/issue_comments.json?author_association=MEMBER&issue=626625818&user=14808389", "results": [{"value": "MEMBER", "label": "MEMBER", "count": 1, "toggle_url": "http://xarray-datasette.fly.dev/github/issue_comments.json?issue=626625818&user=14808389", "selected": true}], "truncated": false}, "user": {"name": "user", "type": "column", "hideable": false, "toggle_url": "/github/issue_comments.json?author_association=MEMBER&issue=626625818&user=14808389", "results": [{"value": 14808389, "label": "keewis", "count": 1, "toggle_url": "http://xarray-datasette.fly.dev/github/issue_comments.json?author_association=MEMBER&issue=626625818", "selected": true}], "truncated": false}, "issue": {"name": "issue", "type": "column", "hideable": false, "toggle_url": "/github/issue_comments.json?author_association=MEMBER&issue=626625818&user=14808389", "results": [{"value": 626625818, "label": "Convert Variable to IndexVariable or vice versa when renamed", "count": 1, "toggle_url": "http://xarray-datasette.fly.dev/github/issue_comments.json?author_association=MEMBER&user=14808389", "selected": true}], "truncated": false}}, "suggested_facets": [{"name": "created_at", "type": "date", "toggle_url": "http://xarray-datasette.fly.dev/github/issue_comments.json?author_association=MEMBER&issue=626625818&user=14808389&_facet_date=created_at"}], "next": null, "next_url": null, "private": false, "allow_execute_sql": true, "query_ms": 3269.3461989983916}