MCPcopy
hub / github.com/pydata/xarray / test_from_series_sparse

Method test_from_series_sparse

xarray/tests/test_dataarray.py:3839–3849  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

3837
3838 @requires_sparse
3839 def test_from_series_sparse(self) -> None:
3840 import sparse
3841
3842 series = pd.Series([1, 2], index=[("a", 1), ("b", 2)])
3843
3844 actual_sparse = DataArray.from_series(series, sparse=True)
3845 actual_dense = DataArray.from_series(series, sparse=False)
3846
3847 assert isinstance(actual_sparse.data, sparse.COO)
3848 actual_sparse.data = actual_sparse.data.todense()
3849 assert_identical(actual_sparse, actual_dense)
3850
3851 @requires_sparse
3852 def test_from_multiindex_series_sparse(self) -> None:

Callers

nothing calls this directly

Calls 3

assert_identicalFunction · 0.90
from_seriesMethod · 0.80
todenseMethod · 0.45

Tested by

no test coverage detected