Skip to content

Commit 8c48c82

Browse files
committed
Fixed warnings
1 parent 8a345d3 commit 8c48c82

File tree

3 files changed

+21
-14
lines changed

3 files changed

+21
-14
lines changed

lib/polars/expr.rb

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3734,15 +3734,7 @@ def xor(other)
37343734
# # │ [9, 10] ┆ 3 ┆ false │
37353735
# # └───────────┴──────────────────┴──────────┘
37363736
def is_in(other, nulls_equal: false)
3737-
if other.is_a?(::Array)
3738-
if other.length == 0
3739-
other = Polars.lit(nil)._rbexpr
3740-
else
3741-
other = Polars.lit(Series.new(other))._rbexpr
3742-
end
3743-
else
3744-
other = Utils.parse_into_expression(other, str_as_lit: false)
3745-
end
3737+
other = Utils.parse_into_expression(other)
37463738
_from_rbexpr(_rbexpr.is_in(other, nulls_equal))
37473739
end
37483740
alias_method :in?, :is_in

lib/polars/series.rb

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2144,18 +2144,33 @@ def is_not_nan
21442144

21452145
# Check if elements of this Series are in the other Series.
21462146
#
2147+
# @param nulls_equal [Boolean]
2148+
# If true, treat null as a distinct value. Null values will not propagate.
2149+
#
21472150
# @return [Series]
21482151
#
21492152
# @example
21502153
# s = Polars::Series.new("a", [1, 2, 3])
2151-
# s2 = Polars::Series.new("b", [2, 4])
2154+
# s2 = Polars::Series.new("b", [2, 4, nil])
21522155
# s2.is_in(s)
21532156
# # =>
2154-
# # shape: (2,)
2157+
# # shape: (3,)
2158+
# # Series: 'b' [bool]
2159+
# # [
2160+
# # true
2161+
# # false
2162+
# # null
2163+
# # ]
2164+
#
2165+
# @example
2166+
# s2.is_in(s, nulls_equal: true)
2167+
# # =>
2168+
# # shape: (3,)
21552169
# # Series: 'b' [bool]
21562170
# # [
21572171
# # true
21582172
# # false
2173+
# # false
21592174
# # ]
21602175
#
21612176
# @example
@@ -2190,7 +2205,7 @@ def is_not_nan
21902205
# # true
21912206
# # false
21922207
# # ]
2193-
def is_in(other)
2208+
def is_in(other, nulls_equal: false)
21942209
super
21952210
end
21962211
alias_method :in?, :is_in

lib/polars/string_expr.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1474,9 +1474,9 @@ def contains_any(patterns, ascii_case_insensitive: false)
14741474
# # │ Can you feel the love tonight ┆ Can me feel the love tonight │
14751475
# # └─────────────────────────────────┴─────────────────────────────────┘
14761476
def replace_many(patterns, replace_with, ascii_case_insensitive: false)
1477-
patterns = Utils.parse_into_expression(patterns, str_as_lit: false, list_as_series: true)
1477+
patterns = Utils.parse_into_expression(patterns, str_as_lit: false)
14781478
replace_with = Utils.parse_into_expression(
1479-
replace_with, str_as_lit: true, list_as_series: true
1479+
replace_with, str_as_lit: true
14801480
)
14811481
Utils.wrap_expr(
14821482
_rbexpr.str_replace_many(

0 commit comments

Comments
 (0)