issues: 197709208
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 |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
197709208 | MDU6SXNzdWUxOTc3MDkyMDg= | 1186 | Including last coordinate values when displaying coordinates | 7441788 | closed | 0 | 2 | 2016-12-27T14:18:19Z | 2018-07-20T16:04:51Z | 2018-07-20T16:04:51Z | CONTRIBUTOR | I first posted this to https://groups.google.com/forum/#!topic/xarray/wjPtXMr91sg . I'm afraid I'm not set up to submit a PR, but I think something like the following should work once one has created a Also, I wonder if it would make sense to change the minimum number of items displayed from 1 to min(2, items_ndarray.size). ``` def format_array_flat(items_ndarray, max_width): """Return a formatted string for as many items in the flattened version of items_ndarray that will fit within max_width characters """ # every item will take up at least two characters, but we always want to # print at least one item max_possibly_relevant = max(int(np.ceil(max_width / 2.0)), 1) relevant_items = sum(([x, y] for (x, y) in zip(first_n_items(items_ndarray, (max_possibly_relevant + 1) // 2), reversed(last_n_items(items_ndarray, max_possibly_relevant // 2)))), []) pprint_items = format_items(relevant_items)
``` |
{ "url": "https://api.github.com/repos/pydata/xarray/issues/1186/reactions", "total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0 } |
completed | 13221727 | issue |