Method: Polars::Functions#ones
- Defined in:
- lib/polars/functions/repeat.rb
#ones(n, dtype: Float64, eager: false) ⇒ Object
Construct a column of length n filled with ones.
This is syntactic sugar for the repeat function.
76 77 78 79 80 81 82 83 |
# File 'lib/polars/functions/repeat.rb', line 76 def ones(n, dtype: Float64, eager: false) if (zero = _one_or_zero_by_dtype(1, dtype)).nil? msg = "invalid dtype for `ones`; found #{dtype}" raise TypeError, msg end repeat(zero, n, dtype: dtype, eager: eager).alias("ones") end |