home / github / pull_requests

Menu
  • GraphQL API
  • Search all tables

pull_requests: 300576778

This data as json

id node_id number state locked title user body created_at updated_at closed_at merged_at merge_commit_sha assignee milestone draft head base author_association auto_merge repo url merged_by
300576778 MDExOlB1bGxSZXF1ZXN0MzAwNTc2Nzc4 3159 closed 0 Initialize empty or full DataArray 23618263 <!-- Feel free to remove check-list items aren't relevant to your change --> I attempted to implement what has been asked for in #277 as an effort to contribute to this project. This PR adds the ability to initialize a DataArray with a constant value, including `np.nan`. Also, if `data = None` then it is initialized as `np.empty` to take advantage of its speed for big arrays. ```python >> foo = xr.DataArray(None, coords=[range(3), range(4)]) >> foo <xarray.DataArray (dim_0: 3, dim_1: 4)> array([[4.673257e-310, 0.000000e+000, 0.000000e+000, 0.000000e+000], [0.000000e+000, 0.000000e+000, 0.000000e+000, 0.000000e+000], [0.000000e+000, 0.000000e+000, 0.000000e+000, 0.000000e+000]]) Coordinates: * dim_0 (dim_0) int64 0 1 2 * dim_1 (dim_1) int64 0 1 2 3 ``` - [x] Closes #878, #277 - [x] Tests added - [x] Fully documented, including `whats-new.rst` for all changes and `api.rst` for new API Regarding the tests, I am not sure how to test the creation of an empty DataArray with `data=None` since the values changes between calls of `np.empty`. This is the reason I only added the test for the constant value. 2019-07-24T06:21:50Z 2019-08-27T16:28:04Z 2019-08-26T20:36:36Z 2019-08-26T20:36:36Z 3c020e58d3bf40101b0f4968f155e4eaa9d70e62     0 2c0c634b2cc9f935745499c0bced6642afa21814 e3b3bed2c2e27eb74adc2b7f80c365c2928cd78b CONTRIBUTOR   13221727 https://github.com/pydata/xarray/pull/3159  

Links from other tables

  • 0 rows from pull_requests_id in labels_pull_requests
Powered by Datasette · Queries took 1.059ms