Skip to content

Commit

Permalink
Allow use of slightly earlier pandas versions (#652)
Browse files Browse the repository at this point in the history
* Allow use of slightly earlier pandas versions

* Merge pull request #643 from tennlee/dask_type_checking

Dask type checking
  • Loading branch information
tennlee authored Sep 4, 2024
1 parent 20a8547 commit 7966a97
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ classifiers = [
]
dependencies = [
"xarray ~= 2024.1",
"pandas ~= 2.2",
"pandas ~= 2.0",
"scipy ~= 1.1",
"bottleneck ~= 1.3",
"scikit-learn ~= 1.4",
Expand Down
4 changes: 2 additions & 2 deletions tests/categorical/test_binary.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ def test_pod_dask():
result = probability_of_detection(fcst_mix.chunk(), obs1.chunk())
assert isinstance(result.data, dask.array.Array)
result = result.compute()
assert isinstance(result.data, np.ndarray)
assert isinstance(result.data, (np.ndarray, np.generic))
xr.testing.assert_equal(result, expected_pod3)


Expand Down Expand Up @@ -134,7 +134,7 @@ def test_pofd_dask():
result = probability_of_false_detection(fcst_mix.chunk(), obs0.chunk())
assert isinstance(result.data, dask.array.Array)
result = result.compute()
assert isinstance(result.data, np.ndarray)
assert isinstance(result.data, (np.ndarray, np.generic))
xr.testing.assert_equal(result, expected_pofd3)


Expand Down
2 changes: 1 addition & 1 deletion tests/categorical/test_contingency.py
Original file line number Diff line number Diff line change
Expand Up @@ -373,7 +373,7 @@ def test_dask_if_available_categorical():

# And that transformed tables are built out of computed things
simple_counts = table.transform().get_counts()
assert isinstance(simple_counts["tp_count"].data, np.ndarray)
assert isinstance(simple_counts["tp_count"].data, (np.ndarray, np.generic))

# And that transformed things get the same numbers
assert table.false_alarm_rate() == table.transform().false_alarm_rate()
Expand Down
2 changes: 1 addition & 1 deletion tests/continuous/test_correlation.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,5 +101,5 @@ def test_correlation_dask():
result = pearsonr(DA3_CORR.chunk(), DA2_CORR.chunk())
assert isinstance(result.data, dask.array.Array)
result = result.compute()
assert isinstance(result.data, np.ndarray)
assert isinstance(result.data, (np.ndarray, np.generic))
xr.testing.assert_allclose(result, EXP_CORR_REDUCE_ALL)
2 changes: 1 addition & 1 deletion tests/continuous/test_flip_flop.py
Original file line number Diff line number Diff line change
Expand Up @@ -414,7 +414,7 @@ def test_flip_flop_index_is_dask_compatible():
assert isinstance(result.data, dask.array.Array)
result = result.compute()
xr.testing.assert_allclose(result, ntd.EXP_FFI_SUB_CASE0)
assert isinstance(result.data, np.ndarray)
assert isinstance(result.data, (np.ndarray, np.generic))


def test_flip_flop_index_proportion_exceeding_is_dask_compatible():
Expand Down
2 changes: 1 addition & 1 deletion tests/probabilty/test_brier.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ def test_brier_score_dask():
result = brier_score(FCST1.chunk(), OBS1.chunk())
assert isinstance(result.data, dask.array.Array)
result = result.compute()
assert isinstance(result.data, np.ndarray)
assert isinstance(result.data, (np.ndarray, np.generic))
xr.testing.assert_equal(result, xr.DataArray(0.1))


Expand Down

0 comments on commit 7966a97

Please sign in to comment.