Skip to content

Commit

Permalink
Fix downstream tests affected by f64 conversion
Browse files Browse the repository at this point in the history
  • Loading branch information
mcrumiller committed Aug 25, 2023
1 parent e1e1ec7 commit ca31f2d
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 10 deletions.
4 changes: 2 additions & 2 deletions crates/polars-core/src/chunked_array/ops/unique/rank.rs
Original file line number Diff line number Diff line change
Expand Up @@ -289,10 +289,10 @@ pub(crate) fn rank(s: &Series, method: RankMethod, descending: bool, seed: Optio
Average => {
// SAFETY: in bounds.
let a = unsafe { count.take_unchecked((&dense).into()) }
.cast(&DataType::Float32)
.cast(&DataType::Float64)
.unwrap();
let b = unsafe { count.take_unchecked((&(dense - 1)).into()) }
.cast(&DataType::Float32)
.cast(&DataType::Float64)
.unwrap()
+ 1.0;
(&a + &b) * 0.5
Expand Down
8 changes: 4 additions & 4 deletions py-polars/tests/unit/namespaces/test_list.py
Original file line number Diff line number Diff line change
Expand Up @@ -168,10 +168,10 @@ def test_list_eval_dtype_inference() -> None:
.list.first()
]
).to_series().to_list() == [
0.3333333432674408,
0.6666666865348816,
0.6666666865348816,
0.3333333432674408,
0.3333333333333333,
0.6666666666666666,
0.6666666666666666,
0.3333333333333333,
]


Expand Down
2 changes: 1 addition & 1 deletion py-polars/tests/unit/series/test_series.py
Original file line number Diff line number Diff line change
Expand Up @@ -1307,7 +1307,7 @@ def test_rank() -> None:
)

assert s.rank(method="average").dtype == pl.Float64
assert pl.Series([1, 2, 3]).rank(method="max").dtype == pl.get_index_type()
assert s.rank(method="max").dtype == pl.get_index_type()


def test_diff() -> None:
Expand Down
2 changes: 1 addition & 1 deletion py-polars/tests/unit/test_exprs.py
Original file line number Diff line number Diff line change
Expand Up @@ -368,7 +368,7 @@ def test_rank() -> None:

s = df.select(pl.col("a").rank(method="max").alias("b")).to_series()
assert s.to_list() == [2, 2, 4, 4, 5]
assert s.dtype == pl.Float64
assert s.dtype == pl.get_index_type()


def test_rank_so_4109() -> None:
Expand Down
4 changes: 2 additions & 2 deletions py-polars/tests/unit/test_lazy.py
Original file line number Diff line number Diff line change
Expand Up @@ -1016,9 +1016,9 @@ def test_spearman_corr_ties() -> None:
)
expected = pl.DataFrame(
[
pl.Series("a1", [-0.19048483669757843], dtype=pl.Float32),
pl.Series("a1", [-0.19048482943986483], dtype=pl.Float64),
pl.Series("a2", [-0.17223653586587362], dtype=pl.Float64),
pl.Series("a3", [-0.19048483669757843], dtype=pl.Float32),
pl.Series("a3", [-0.19048482943986483], dtype=pl.Float64),
]
)
assert_frame_equal(result, expected)
Expand Down

0 comments on commit ca31f2d

Please sign in to comment.