Skip to content

Commit d8412e8

Browse files
authored
Fixing compiler warnings and typo (#1159)
1 parent c878c31 commit d8412e8

5 files changed

Lines changed: 25 additions & 16 deletions

File tree

lib/explorer/backend/lazy_series.ex

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -822,9 +822,7 @@ defmodule Explorer.Backend.LazySeries do
822822
when op in [:first, :last, :sum, :min, :max, :product],
823823
do: series.dtype
824824

825-
defp dtype_for_agg_operation(op, _) when op in [:all?, :any?], do: :boolean
826825
defp dtype_for_agg_operation(:mode, series), do: {:list, series.dtype}
827-
828826
defp dtype_for_agg_operation(_, _), do: {:f, 64}
829827

830828
defp resolve_numeric_dtype(items) do
@@ -1077,13 +1075,6 @@ defmodule Explorer.Backend.LazySeries do
10771075

10781076
defp to_elixir_ast(other), do: other
10791077

1080-
@impl true
1081-
def size(series) do
1082-
data = new(:size, [lazy_series!(series)], {:u, 32})
1083-
1084-
Backend.Series.new(data, {:u, 32})
1085-
end
1086-
10871078
@impl true
10881079
def transform(_series, _fun) do
10891080
raise """

lib/explorer/polars_backend/expression.ex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -322,7 +322,7 @@ defmodule Explorer.PolarsBackend.Expression do
322322
Native.expr_int_range(to_expr(0), size_expr, 1, {:u, 32})
323323
end
324324

325-
for {op, arity} <- @all_expressions do
325+
for {op, arity} <- @all_expressions -- @first_only_expressions do
326326
args = Macro.generate_arguments(arity, __MODULE__)
327327

328328
updates =

lib/explorer/series.ex

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1143,7 +1143,7 @@ defmodule Explorer.Series do
11431143
do: apply_series(series, :strftime, [format_string])
11441144

11451145
def strftime(%Series{dtype: dtype}, _format_string),
1146-
do: dtype_error("strftime/2", dtype, :datetime_like)
1146+
do: dtype_error("strftime/2", dtype, [:datetime_like])
11471147

11481148
@doc """
11491149
Clip (or clamp) the values in a series.
@@ -5346,15 +5346,15 @@ defmodule Explorer.Series do
53465346

53475347
float_series =
53485348
case dtype(series) do
5349-
:f32 ->
5349+
{:f, 32} ->
53505350
series
53515351

5352-
:f64 ->
5352+
{:f, 64} ->
53535353
series
53545354

53555355
_ ->
53565356
try do
5357-
cast(series, :f64)
5357+
cast(series, {:f, 64})
53585358
rescue
53595359
_ ->
53605360
raise ArgumentError,

notebooks/exploring_explorer.livemd

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -800,7 +800,7 @@ In `Explorer`, like in `dplyr`, we have five main verbs to work with dataframes:
800800
- sort
801801
- summarise
802802

803-
We are going to explore then in this notebook, but first we need to "require"
803+
We are going to explore them in this notebook, but first we need to "require"
804804
the `Explorer.DataFrame` module in order to load the macros needed for these verbs.
805805

806806
I want to take the opportunity to create a shorter alias for the `DataFrame` module,

test/explorer/series_test.exs

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4658,7 +4658,7 @@ defmodule Explorer.SeriesTest do
46584658
end
46594659

46604660
describe "ewm_mean/2" do
4661-
test "returns calculated ewm values with default options used for calculation" do
4661+
test "returns calculated ewm values with default options used for integer calculation" do
46624662
s1 = 1..10 |> Enum.to_list() |> Series.from_list()
46634663
s2 = Series.ewm_mean(s1)
46644664

@@ -4676,6 +4676,24 @@ defmodule Explorer.SeriesTest do
46764676
])
46774677
end
46784678

4679+
test "returns calculated ewm values with default options used for f64 calculation" do
4680+
s1 = Series.from_list([1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0])
4681+
s2 = Series.ewm_mean(s1)
4682+
4683+
assert all_close?(s2, [
4684+
1.0,
4685+
1.6666666666666667,
4686+
2.4285714285714284,
4687+
3.2666666666666666,
4688+
4.161290322580645,
4689+
5.095238095238095,
4690+
6.05511811023622,
4691+
7.031372549019608,
4692+
8.017612524461839,
4693+
9.009775171065494
4694+
])
4695+
end
4696+
46794697
test "returns calculated ewma with differernt smoothing factor if different alpha is passed" do
46804698
s1 = 1..10 |> Enum.to_list() |> Series.from_list()
46814699
s2 = Series.ewm_mean(s1, alpha: 0.8)

0 commit comments

Comments
 (0)