本文整理汇总了Python中holoviews.core.data.Dataset.select方法的典型用法代码示例。如果您正苦于以下问题:Python Dataset.select方法的具体用法?Python Dataset.select怎么用?Python Dataset.select使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类holoviews.core.data.Dataset
的用法示例。
在下文中一共展示了Dataset.select方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_select_dropped_dimensions_restoration
# 需要导入模块: from holoviews.core.data import Dataset [as 别名]
# 或者: from holoviews.core.data.Dataset import select [as 别名]
def test_select_dropped_dimensions_restoration(self):
d = np.random.randn(3, 8)
da = xr.DataArray(d, name='stuff', dims=['chain', 'value'],
coords=dict(chain=range(d.shape[0]), value=range(d.shape[1])))
ds = Dataset(da)
t = ds.select(chain=0)
self.assertEqual(t.data.dims , dict(chain=1,value=8))
self.assertEqual(t.data.stuff.shape , (1,8))
示例2: test_dataset_groupby_multiple_dims
# 需要导入模块: from holoviews.core.data import Dataset [as 别名]
# 或者: from holoviews.core.data.Dataset import select [as 别名]
def test_dataset_groupby_multiple_dims(self):
dataset = Dataset((range(8), range(8), range(8), range(8),
da.from_array(np.random.rand(8, 8, 8, 8), 4)),
kdims=['a', 'b', 'c', 'd'], vdims=['Value'])
grouped = dataset.groupby(['c', 'd'])
keys = list(product(range(8), range(8)))
self.assertEqual(list(grouped.keys()), keys)
for c, d in keys:
self.assertEqual(grouped[c, d], dataset.select(c=c, d=d).reindex(['a', 'b']))
示例3: test_select_multi_slice2
# 需要导入模块: from holoviews.core.data import Dataset [as 别名]
# 或者: from holoviews.core.data.Dataset import select [as 别名]
def test_select_multi_slice2(self):
cube = Dataset(self.cube)
self.assertEqual(cube.select(longitude={0, 2},
latitude={0, 2}).data.data,
np.array([[5, 7]], dtype=np.int32))
示例4: test_select_multi_slice1
# 需要导入模块: from holoviews.core.data import Dataset [as 别名]
# 或者: from holoviews.core.data.Dataset import select [as 别名]
def test_select_multi_slice1(self):
cube = Dataset(self.cube)
self.assertEqual(cube.select(longitude=(0, 1+self.epsilon),
latitude=(0, 1+self.epsilon)).data.data,
np.array([[5, 6], [9, 10]], dtype=np.int32))
示例5: test_select_multi_index
# 需要导入模块: from holoviews.core.data import Dataset [as 别名]
# 或者: from holoviews.core.data.Dataset import select [as 别名]
def test_select_multi_index(self):
cube = Dataset(self.cube)
self.assertEqual(cube.select(longitude=0, latitude=0), 5)
示例6: test_select_set
# 需要导入模块: from holoviews.core.data import Dataset [as 别名]
# 或者: from holoviews.core.data.Dataset import select [as 别名]
def test_select_set(self):
cube = Dataset(self.cube)
self.assertEqual(cube.select(longitude={0, 1}).data.data,
np.array([[1, 2], [5, 6], [9, 10]], dtype=np.int32))
示例7: test_select_index
# 需要导入模块: from holoviews.core.data import Dataset [as 别名]
# 或者: from holoviews.core.data.Dataset import select [as 别名]
def test_select_index(self):
cube = Dataset(self.cube)
self.assertEqual(cube.select(longitude=0).data.data,
np.array([[1, 5, 9]], dtype=np.int32))
示例8: test_select_lazy
# 需要导入模块: from holoviews.core.data import Dataset [as 别名]
# 或者: from holoviews.core.data.Dataset import select [as 别名]
def test_select_lazy(self):
import dask.array as da
arr = da.from_array(np.arange(1, 12), 3)
ds = Dataset({'x': range(11), 'y': arr}, 'x', 'y')
self.assertIsInstance(ds.select(x=(0, 5)).data['y'], da.Array)