home / github / issues

Menu
  • GraphQL API
  • Search all tables

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 last_n_items() similar to the existing first_n_items().

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)

cum_len = np.cumsum([len(s) + 1 for s in pprint_items]) - 1
if (max_possibly_relevant < items_ndarray.size or
        (cum_len > max_width).any()):
    padding = u' ... '
    count = max(np.argmax((cum_len + len(padding)) > max_width), 1)
else:
    count = items_ndarray.size
    padding = u'' if (count <= 1) else u' '

pprint_str = u' '.join(np.take(pprint_items, range(0, count, 2))) + padding + \
             u' '.join(np.take(pprint_items, range(count - (count % 2) - 1, 0, -2)))
return pprint_str

```

{
    "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

Links from other tables

  • 2 rows from issues_id in issues_labels
  • 2 rows from issue in issue_comments
Powered by Datasette · Queries took 2.366ms · About: xarray-datasette