polars-df 0.7.0-arm64-darwin → 0.8.0-arm64-darwin
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +12 -0
- data/Cargo.lock +284 -216
- data/LICENSE-THIRD-PARTY.txt +719 -1172
- data/lib/polars/3.1/polars.bundle +0 -0
- data/lib/polars/3.2/polars.bundle +0 -0
- data/lib/polars/{3.0 → 3.3}/polars.bundle +0 -0
- data/lib/polars/data_frame.rb +69 -65
- data/lib/polars/data_types.rb +4 -1
- data/lib/polars/date_time_expr.rb +10 -10
- data/lib/polars/date_time_name_space.rb +12 -12
- data/lib/polars/expr.rb +223 -18
- data/lib/polars/group_by.rb +1 -1
- data/lib/polars/io.rb +4 -4
- data/lib/polars/lazy_frame.rb +23 -23
- data/lib/polars/lazy_functions.rb +4 -20
- data/lib/polars/series.rb +289 -30
- data/lib/polars/sql_context.rb +1 -1
- data/lib/polars/struct_expr.rb +1 -1
- data/lib/polars/struct_name_space.rb +1 -1
- data/lib/polars/utils.rb +13 -13
- data/lib/polars/version.rb +1 -1
- metadata +5 -5
| Binary file | 
| Binary file | 
| Binary file | 
    
        data/lib/polars/data_frame.rb
    CHANGED
    
    | @@ -119,10 +119,10 @@ module Polars | |
| 119 119 |  | 
| 120 120 | 
             
                  processed_null_values = Utils._process_null_values(null_values)
         | 
| 121 121 |  | 
| 122 | 
            -
                  if columns.is_a?(String)
         | 
| 122 | 
            +
                  if columns.is_a?(::String)
         | 
| 123 123 | 
             
                    columns = [columns]
         | 
| 124 124 | 
             
                  end
         | 
| 125 | 
            -
                  if file.is_a?(String) && file.include?("*")
         | 
| 125 | 
            +
                  if file.is_a?(::String) && file.include?("*")
         | 
| 126 126 | 
             
                    dtypes_dict = nil
         | 
| 127 127 | 
             
                    if !dtype_list.nil?
         | 
| 128 128 | 
             
                      dtypes_dict = dtype_list.to_h
         | 
| @@ -206,11 +206,11 @@ module Polars | |
| 206 206 | 
             
                  if Utils.pathlike?(source)
         | 
| 207 207 | 
             
                    source = Utils.normalise_filepath(source)
         | 
| 208 208 | 
             
                  end
         | 
| 209 | 
            -
                  if columns.is_a?(String)
         | 
| 209 | 
            +
                  if columns.is_a?(::String)
         | 
| 210 210 | 
             
                    columns = [columns]
         | 
| 211 211 | 
             
                  end
         | 
| 212 212 |  | 
| 213 | 
            -
                  if source.is_a?(String) && source.include?("*") && Utils.local_file?(source)
         | 
| 213 | 
            +
                  if source.is_a?(::String) && source.include?("*") && Utils.local_file?(source)
         | 
| 214 214 | 
             
                    scan =
         | 
| 215 215 | 
             
                      Polars.scan_parquet(
         | 
| 216 216 | 
             
                        source,
         | 
| @@ -269,11 +269,11 @@ module Polars | |
| 269 269 | 
             
                  if Utils.pathlike?(file)
         | 
| 270 270 | 
             
                    file = Utils.normalise_filepath(file)
         | 
| 271 271 | 
             
                  end
         | 
| 272 | 
            -
                  if columns.is_a?(String)
         | 
| 272 | 
            +
                  if columns.is_a?(::String)
         | 
| 273 273 | 
             
                    columns = [columns]
         | 
| 274 274 | 
             
                  end
         | 
| 275 275 |  | 
| 276 | 
            -
                  if file.is_a?(String) && file.include?("*")
         | 
| 276 | 
            +
                  if file.is_a?(::String) && file.include?("*")
         | 
| 277 277 | 
             
                    raise Todo
         | 
| 278 278 | 
             
                  end
         | 
| 279 279 |  | 
| @@ -411,7 +411,7 @@ module Polars | |
| 411 411 | 
             
                #     }
         | 
| 412 412 | 
             
                #   )
         | 
| 413 413 | 
             
                #   df.dtypes
         | 
| 414 | 
            -
                #   # => [Polars::Int64, Polars::Float64, Polars:: | 
| 414 | 
            +
                #   # => [Polars::Int64, Polars::Float64, Polars::String]
         | 
| 415 415 | 
             
                def dtypes
         | 
| 416 416 | 
             
                  _df.dtypes
         | 
| 417 417 | 
             
                end
         | 
| @@ -429,7 +429,7 @@ module Polars | |
| 429 429 | 
             
                #     }
         | 
| 430 430 | 
             
                #   )
         | 
| 431 431 | 
             
                #   df.schema
         | 
| 432 | 
            -
                #   # => {"foo"=>Polars::Int64, "bar"=>Polars::Float64, "ham"=>Polars:: | 
| 432 | 
            +
                #   # => {"foo"=>Polars::Int64, "bar"=>Polars::Float64, "ham"=>Polars::String}
         | 
| 433 433 | 
             
                def schema
         | 
| 434 434 | 
             
                  columns.zip(dtypes).to_h
         | 
| 435 435 | 
             
                end
         | 
| @@ -589,13 +589,13 @@ module Polars | |
| 589 589 | 
             
                        return df.slice(row_selection, 1)
         | 
| 590 590 | 
             
                      end
         | 
| 591 591 | 
             
                      # df[2, "a"]
         | 
| 592 | 
            -
                      if col_selection.is_a?(String) || col_selection.is_a?(Symbol)
         | 
| 592 | 
            +
                      if col_selection.is_a?(::String) || col_selection.is_a?(Symbol)
         | 
| 593 593 | 
             
                        return self[col_selection][row_selection]
         | 
| 594 594 | 
             
                      end
         | 
| 595 595 | 
             
                    end
         | 
| 596 596 |  | 
| 597 597 | 
             
                    # column selection can be "a" and ["a", "b"]
         | 
| 598 | 
            -
                    if col_selection.is_a?(String) || col_selection.is_a?(Symbol)
         | 
| 598 | 
            +
                    if col_selection.is_a?(::String) || col_selection.is_a?(Symbol)
         | 
| 599 599 | 
             
                      col_selection = [col_selection]
         | 
| 600 600 | 
             
                    end
         | 
| 601 601 |  | 
| @@ -621,7 +621,7 @@ module Polars | |
| 621 621 |  | 
| 622 622 | 
             
                    # select single column
         | 
| 623 623 | 
             
                    # df["foo"]
         | 
| 624 | 
            -
                    if item.is_a?(String) || item.is_a?(Symbol)
         | 
| 624 | 
            +
                    if item.is_a?(::String) || item.is_a?(Symbol)
         | 
| 625 625 | 
             
                      return Utils.wrap_s(_df.column(item.to_s))
         | 
| 626 626 | 
             
                    end
         | 
| 627 627 |  | 
| @@ -647,7 +647,7 @@ module Polars | |
| 647 647 |  | 
| 648 648 | 
             
                    if item.is_a?(Series)
         | 
| 649 649 | 
             
                      dtype = item.dtype
         | 
| 650 | 
            -
                      if dtype ==  | 
| 650 | 
            +
                      if dtype == String
         | 
| 651 651 | 
             
                        return _from_rbdf(_df.select(item))
         | 
| 652 652 | 
             
                      elsif dtype == UInt32
         | 
| 653 653 | 
             
                        return _from_rbdf(_df.take_with_series(item._s))
         | 
| @@ -698,7 +698,7 @@ module Polars | |
| 698 698 | 
             
                    s[row_selection] = value
         | 
| 699 699 |  | 
| 700 700 | 
             
                    if col_selection.is_a?(Integer)
         | 
| 701 | 
            -
                       | 
| 701 | 
            +
                      replace_column(col_selection, s)
         | 
| 702 702 | 
             
                    elsif Utils.strlike?(col_selection)
         | 
| 703 703 | 
             
                      replace(col_selection, s)
         | 
| 704 704 | 
             
                    end
         | 
| @@ -1222,7 +1222,7 @@ module Polars | |
| 1222 1222 | 
             
                # @example
         | 
| 1223 1223 | 
             
                #   df = Polars::DataFrame.new({"foo" => [1, 2, 3], "bar" => [4, 5, 6]})
         | 
| 1224 1224 | 
             
                #   s = Polars::Series.new("baz", [97, 98, 99])
         | 
| 1225 | 
            -
                #   df. | 
| 1225 | 
            +
                #   df.insert_column(1, s)
         | 
| 1226 1226 | 
             
                #   # =>
         | 
| 1227 1227 | 
             
                #   # shape: (3, 3)
         | 
| 1228 1228 | 
             
                #   # ┌─────┬─────┬─────┐
         | 
| @@ -1244,7 +1244,7 @@ module Polars | |
| 1244 1244 | 
             
                #     }
         | 
| 1245 1245 | 
             
                #   )
         | 
| 1246 1246 | 
             
                #   s = Polars::Series.new("d", [-2.5, 15, 20.5, 0])
         | 
| 1247 | 
            -
                #   df. | 
| 1247 | 
            +
                #   df.insert_column(3, s)
         | 
| 1248 1248 | 
             
                #   # =>
         | 
| 1249 1249 | 
             
                #   # shape: (4, 4)
         | 
| 1250 1250 | 
             
                #   # ┌─────┬──────┬───────┬──────┐
         | 
| @@ -1257,13 +1257,14 @@ module Polars | |
| 1257 1257 | 
             
                #   # │ 3   ┆ 10.0 ┆ false ┆ 20.5 │
         | 
| 1258 1258 | 
             
                #   # │ 4   ┆ 13.0 ┆ true  ┆ 0.0  │
         | 
| 1259 1259 | 
             
                #   # └─────┴──────┴───────┴──────┘
         | 
| 1260 | 
            -
                def  | 
| 1260 | 
            +
                def insert_column(index, series)
         | 
| 1261 1261 | 
             
                  if index < 0
         | 
| 1262 1262 | 
             
                    index = columns.length + index
         | 
| 1263 1263 | 
             
                  end
         | 
| 1264 | 
            -
                  _df. | 
| 1264 | 
            +
                  _df.insert_column(index, series._s)
         | 
| 1265 1265 | 
             
                  self
         | 
| 1266 1266 | 
             
                end
         | 
| 1267 | 
            +
                alias_method :insert_at_idx, :insert_column
         | 
| 1267 1268 |  | 
| 1268 1269 | 
             
                # Filter the rows in the DataFrame based on a predicate expression.
         | 
| 1269 1270 | 
             
                #
         | 
| @@ -1367,7 +1368,7 @@ module Polars | |
| 1367 1368 | 
             
                      ]
         | 
| 1368 1369 | 
             
                    )._df
         | 
| 1369 1370 | 
             
                  )
         | 
| 1370 | 
            -
                  summary. | 
| 1371 | 
            +
                  summary.insert_column(
         | 
| 1371 1372 | 
             
                    0,
         | 
| 1372 1373 | 
             
                    Polars::Series.new(
         | 
| 1373 1374 | 
             
                      "describe",
         | 
| @@ -1388,11 +1389,12 @@ module Polars | |
| 1388 1389 | 
             
                #   df = Polars::DataFrame.new(
         | 
| 1389 1390 | 
             
                #     {"foo" => [1, 2, 3], "bar" => [6, 7, 8], "ham" => ["a", "b", "c"]}
         | 
| 1390 1391 | 
             
                #   )
         | 
| 1391 | 
            -
                #   df. | 
| 1392 | 
            +
                #   df.get_column_index("ham")
         | 
| 1392 1393 | 
             
                #   # => 2
         | 
| 1393 | 
            -
                def  | 
| 1394 | 
            -
                  _df. | 
| 1394 | 
            +
                def get_column_index(name)
         | 
| 1395 | 
            +
                  _df.get_column_index(name)
         | 
| 1395 1396 | 
             
                end
         | 
| 1397 | 
            +
                alias_method :find_idx_by_name, :get_column_index
         | 
| 1396 1398 |  | 
| 1397 1399 | 
             
                # Replace a column at an index location.
         | 
| 1398 1400 | 
             
                #
         | 
| @@ -1412,7 +1414,7 @@ module Polars | |
| 1412 1414 | 
             
                #     }
         | 
| 1413 1415 | 
             
                #   )
         | 
| 1414 1416 | 
             
                #   s = Polars::Series.new("apple", [10, 20, 30])
         | 
| 1415 | 
            -
                #   df. | 
| 1417 | 
            +
                #   df.replace_column(0, s)
         | 
| 1416 1418 | 
             
                #   # =>
         | 
| 1417 1419 | 
             
                #   # shape: (3, 3)
         | 
| 1418 1420 | 
             
                #   # ┌───────┬─────┬─────┐
         | 
| @@ -1424,13 +1426,14 @@ module Polars | |
| 1424 1426 | 
             
                #   # │ 20    ┆ 7   ┆ b   │
         | 
| 1425 1427 | 
             
                #   # │ 30    ┆ 8   ┆ c   │
         | 
| 1426 1428 | 
             
                #   # └───────┴─────┴─────┘
         | 
| 1427 | 
            -
                def  | 
| 1429 | 
            +
                def replace_column(index, series)
         | 
| 1428 1430 | 
             
                  if index < 0
         | 
| 1429 1431 | 
             
                    index = columns.length + index
         | 
| 1430 1432 | 
             
                  end
         | 
| 1431 | 
            -
                  _df. | 
| 1433 | 
            +
                  _df.replace_column(index, series._s)
         | 
| 1432 1434 | 
             
                  self
         | 
| 1433 1435 | 
             
                end
         | 
| 1436 | 
            +
                alias_method :replace_at_idx, :replace_column
         | 
| 1434 1437 |  | 
| 1435 1438 | 
             
                # Sort the DataFrame by column.
         | 
| 1436 1439 | 
             
                #
         | 
| @@ -1524,13 +1527,14 @@ module Polars | |
| 1524 1527 | 
             
                #       "ham" => ["c", "b", "a"]
         | 
| 1525 1528 | 
             
                #     }
         | 
| 1526 1529 | 
             
                #   )
         | 
| 1527 | 
            -
                #   df1. | 
| 1530 | 
            +
                #   df1.equals(df1)
         | 
| 1528 1531 | 
             
                #   # => true
         | 
| 1529 | 
            -
                #   df1. | 
| 1532 | 
            +
                #   df1.equals(df2)
         | 
| 1530 1533 | 
             
                #   # => false
         | 
| 1531 | 
            -
                def  | 
| 1532 | 
            -
                  _df. | 
| 1534 | 
            +
                def equals(other, null_equal: true)
         | 
| 1535 | 
            +
                  _df.equals(other._df, null_equal)
         | 
| 1533 1536 | 
             
                end
         | 
| 1537 | 
            +
                alias_method :frame_equal, :equals
         | 
| 1534 1538 |  | 
| 1535 1539 | 
             
                # Replace a column by a new Series.
         | 
| 1536 1540 | 
             
                #
         | 
| @@ -1716,7 +1720,7 @@ module Polars | |
| 1716 1720 | 
             
                #   # │ 3   ┆ 8   ┆ c   │
         | 
| 1717 1721 | 
             
                #   # └─────┴─────┴─────┘
         | 
| 1718 1722 | 
             
                def drop_nulls(subset: nil)
         | 
| 1719 | 
            -
                  if subset.is_a?(String)
         | 
| 1723 | 
            +
                  if subset.is_a?(::String)
         | 
| 1720 1724 | 
             
                    subset = [subset]
         | 
| 1721 1725 | 
             
                  end
         | 
| 1722 1726 | 
             
                  _from_rbdf(_df.drop_nulls(subset))
         | 
| @@ -2267,7 +2271,7 @@ module Polars | |
| 2267 2271 | 
             
                  if by.nil?
         | 
| 2268 2272 | 
             
                    by = []
         | 
| 2269 2273 | 
             
                  end
         | 
| 2270 | 
            -
                  if by.is_a?(String)
         | 
| 2274 | 
            +
                  if by.is_a?(::String)
         | 
| 2271 2275 | 
             
                    by = [by]
         | 
| 2272 2276 | 
             
                  end
         | 
| 2273 2277 | 
             
                  if offset.nil?
         | 
| @@ -2461,17 +2465,17 @@ module Polars | |
| 2461 2465 | 
             
                # @example
         | 
| 2462 2466 | 
             
                #   df.join(other_df, on: "ham", how: "outer")
         | 
| 2463 2467 | 
             
                #   # =>
         | 
| 2464 | 
            -
                #   # shape: (4,  | 
| 2465 | 
            -
                #   #  | 
| 2466 | 
            -
                #   # │ foo  ┆ bar  ┆ ham | 
| 2467 | 
            -
                #   # │ ---  ┆ ---  ┆ --- ┆ --- | 
| 2468 | 
            -
                #   # │ i64  ┆ f64  ┆ str ┆ str | 
| 2469 | 
            -
                #   #  | 
| 2470 | 
            -
                #   # │ 1    ┆ 6.0  ┆ a | 
| 2471 | 
            -
                #   # │ 2    ┆ 7.0  ┆ b | 
| 2472 | 
            -
                #   # │ null ┆ null ┆  | 
| 2473 | 
            -
                #   # │ 3    ┆ 8.0  ┆ c | 
| 2474 | 
            -
                #   #  | 
| 2468 | 
            +
                #   # shape: (4, 5)
         | 
| 2469 | 
            +
                #   # ┌──────┬──────┬──────┬───────┬───────────┐
         | 
| 2470 | 
            +
                #   # │ foo  ┆ bar  ┆ ham  ┆ apple ┆ ham_right │
         | 
| 2471 | 
            +
                #   # │ ---  ┆ ---  ┆ ---  ┆ ---   ┆ ---       │
         | 
| 2472 | 
            +
                #   # │ i64  ┆ f64  ┆ str  ┆ str   ┆ str       │
         | 
| 2473 | 
            +
                #   # ╞══════╪══════╪══════╪═══════╪═══════════╡
         | 
| 2474 | 
            +
                #   # │ 1    ┆ 6.0  ┆ a    ┆ x     ┆ a         │
         | 
| 2475 | 
            +
                #   # │ 2    ┆ 7.0  ┆ b    ┆ y     ┆ b         │
         | 
| 2476 | 
            +
                #   # │ null ┆ null ┆ null ┆ z     ┆ d         │
         | 
| 2477 | 
            +
                #   # │ 3    ┆ 8.0  ┆ c    ┆ null  ┆ null      │
         | 
| 2478 | 
            +
                #   # └──────┴──────┴──────┴───────┴───────────┘
         | 
| 2475 2479 | 
             
                #
         | 
| 2476 2480 | 
             
                # @example
         | 
| 2477 2481 | 
             
                #   df.join(other_df, on: "ham", how: "left")
         | 
| @@ -3111,17 +3115,17 @@ module Polars | |
| 3111 3115 | 
             
                  sort_columns: false,
         | 
| 3112 3116 | 
             
                  separator: "_"
         | 
| 3113 3117 | 
             
                )
         | 
| 3114 | 
            -
                  if values.is_a?(String)
         | 
| 3118 | 
            +
                  if values.is_a?(::String)
         | 
| 3115 3119 | 
             
                    values = [values]
         | 
| 3116 3120 | 
             
                  end
         | 
| 3117 | 
            -
                  if index.is_a?(String)
         | 
| 3121 | 
            +
                  if index.is_a?(::String)
         | 
| 3118 3122 | 
             
                    index = [index]
         | 
| 3119 3123 | 
             
                  end
         | 
| 3120 | 
            -
                  if columns.is_a?(String)
         | 
| 3124 | 
            +
                  if columns.is_a?(::String)
         | 
| 3121 3125 | 
             
                    columns = [columns]
         | 
| 3122 3126 | 
             
                  end
         | 
| 3123 3127 |  | 
| 3124 | 
            -
                  if aggregate_fn.is_a?(String)
         | 
| 3128 | 
            +
                  if aggregate_fn.is_a?(::String)
         | 
| 3125 3129 | 
             
                    case aggregate_fn
         | 
| 3126 3130 | 
             
                    when "first"
         | 
| 3127 3131 | 
             
                      aggregate_expr = Polars.element.first._rbexpr
         | 
| @@ -3206,10 +3210,10 @@ module Polars | |
| 3206 3210 | 
             
                #   # │ z   ┆ c        ┆ 6     │
         | 
| 3207 3211 | 
             
                #   # └─────┴──────────┴───────┘
         | 
| 3208 3212 | 
             
                def melt(id_vars: nil, value_vars: nil, variable_name: nil, value_name: nil)
         | 
| 3209 | 
            -
                  if value_vars.is_a?(String)
         | 
| 3213 | 
            +
                  if value_vars.is_a?(::String)
         | 
| 3210 3214 | 
             
                    value_vars = [value_vars]
         | 
| 3211 3215 | 
             
                  end
         | 
| 3212 | 
            -
                  if id_vars.is_a?(String)
         | 
| 3216 | 
            +
                  if id_vars.is_a?(::String)
         | 
| 3213 3217 | 
             
                    id_vars = [id_vars]
         | 
| 3214 3218 | 
             
                  end
         | 
| 3215 3219 | 
             
                  if value_vars.nil?
         | 
| @@ -3423,7 +3427,7 @@ module Polars | |
| 3423 3427 | 
             
                #   # │ C   ┆ 2   ┆ l   │
         | 
| 3424 3428 | 
             
                #   # └─────┴─────┴─────┘}
         | 
| 3425 3429 | 
             
                def partition_by(groups, maintain_order: true, include_key: true, as_dict: false)
         | 
| 3426 | 
            -
                  if groups.is_a?(String)
         | 
| 3430 | 
            +
                  if groups.is_a?(::String)
         | 
| 3427 3431 | 
             
                    groups = [groups]
         | 
| 3428 3432 | 
             
                  elsif !groups.is_a?(::Array)
         | 
| 3429 3433 | 
             
                    groups = Array(groups)
         | 
| @@ -3774,7 +3778,7 @@ module Polars | |
| 3774 3778 | 
             
                #   # └─────┴─────┴─────┘
         | 
| 3775 3779 | 
             
                def max(axis: 0)
         | 
| 3776 3780 | 
             
                  if axis == 0
         | 
| 3777 | 
            -
                     | 
| 3781 | 
            +
                    lazy.max.collect(_eager: true)
         | 
| 3778 3782 | 
             
                  elsif axis == 1
         | 
| 3779 3783 | 
             
                    Utils.wrap_s(_df.max_horizontal)
         | 
| 3780 3784 | 
             
                  else
         | 
| @@ -3806,7 +3810,7 @@ module Polars | |
| 3806 3810 | 
             
                #   # └─────┴─────┴─────┘
         | 
| 3807 3811 | 
             
                def min(axis: 0)
         | 
| 3808 3812 | 
             
                  if axis == 0
         | 
| 3809 | 
            -
                     | 
| 3813 | 
            +
                    lazy.min.collect(_eager: true)
         | 
| 3810 3814 | 
             
                  elsif axis == 1
         | 
| 3811 3815 | 
             
                    Utils.wrap_s(_df.min_horizontal)
         | 
| 3812 3816 | 
             
                  else
         | 
| @@ -3855,7 +3859,7 @@ module Polars | |
| 3855 3859 | 
             
                def sum(axis: 0, null_strategy: "ignore")
         | 
| 3856 3860 | 
             
                  case axis
         | 
| 3857 3861 | 
             
                  when 0
         | 
| 3858 | 
            -
                     | 
| 3862 | 
            +
                    lazy.sum.collect(_eager: true)
         | 
| 3859 3863 | 
             
                  when 1
         | 
| 3860 3864 | 
             
                    Utils.wrap_s(_df.sum_horizontal(null_strategy))
         | 
| 3861 3865 | 
             
                  else
         | 
| @@ -3893,7 +3897,7 @@ module Polars | |
| 3893 3897 | 
             
                def mean(axis: 0, null_strategy: "ignore")
         | 
| 3894 3898 | 
             
                  case axis
         | 
| 3895 3899 | 
             
                  when 0
         | 
| 3896 | 
            -
                     | 
| 3900 | 
            +
                    lazy.mean.collect(_eager: true)
         | 
| 3897 3901 | 
             
                  when 1
         | 
| 3898 3902 | 
             
                    Utils.wrap_s(_df.mean_horizontal(null_strategy))
         | 
| 3899 3903 | 
             
                  else
         | 
| @@ -3939,7 +3943,7 @@ module Polars | |
| 3939 3943 | 
             
                #   # │ 0.816497 ┆ 0.816497 ┆ null │
         | 
| 3940 3944 | 
             
                #   # └──────────┴──────────┴──────┘
         | 
| 3941 3945 | 
             
                def std(ddof: 1)
         | 
| 3942 | 
            -
                   | 
| 3946 | 
            +
                  lazy.std(ddof: ddof).collect(_eager: true)
         | 
| 3943 3947 | 
             
                end
         | 
| 3944 3948 |  | 
| 3945 3949 | 
             
                # Aggregate the columns of this DataFrame to their variance value.
         | 
| @@ -3980,7 +3984,7 @@ module Polars | |
| 3980 3984 | 
             
                #   # │ 0.666667 ┆ 0.666667 ┆ null │
         | 
| 3981 3985 | 
             
                #   # └──────────┴──────────┴──────┘
         | 
| 3982 3986 | 
             
                def var(ddof: 1)
         | 
| 3983 | 
            -
                   | 
| 3987 | 
            +
                  lazy.var(ddof: ddof).collect(_eager: true)
         | 
| 3984 3988 | 
             
                end
         | 
| 3985 3989 |  | 
| 3986 3990 | 
             
                # Aggregate the columns of this DataFrame to their median value.
         | 
| @@ -4006,7 +4010,7 @@ module Polars | |
| 4006 4010 | 
             
                #   # │ 2.0 ┆ 7.0 ┆ null │
         | 
| 4007 4011 | 
             
                #   # └─────┴─────┴──────┘
         | 
| 4008 4012 | 
             
                def median
         | 
| 4009 | 
            -
                   | 
| 4013 | 
            +
                  lazy.median.collect(_eager: true)
         | 
| 4010 4014 | 
             
                end
         | 
| 4011 4015 |  | 
| 4012 4016 | 
             
                # Aggregate the columns of this DataFrame to their product values.
         | 
| @@ -4063,7 +4067,7 @@ module Polars | |
| 4063 4067 | 
             
                #   # │ 2.0 ┆ 7.0 ┆ null │
         | 
| 4064 4068 | 
             
                #   # └─────┴─────┴──────┘
         | 
| 4065 4069 | 
             
                def quantile(quantile, interpolation: "nearest")
         | 
| 4066 | 
            -
                   | 
| 4070 | 
            +
                  lazy.quantile(quantile, interpolation: interpolation).collect(_eager: true)
         | 
| 4067 4071 | 
             
                end
         | 
| 4068 4072 |  | 
| 4069 4073 | 
             
                # Get one hot encoded dummy variables.
         | 
| @@ -4094,7 +4098,7 @@ module Polars | |
| 4094 4098 | 
             
                #   # │ 0     ┆ 1     ┆ 0     ┆ 1     ┆ 0     ┆ 1     │
         | 
| 4095 4099 | 
             
                #   # └───────┴───────┴───────┴───────┴───────┴───────┘
         | 
| 4096 4100 | 
             
                def to_dummies(columns: nil, separator: "_", drop_first: false)
         | 
| 4097 | 
            -
                  if columns.is_a?(String)
         | 
| 4101 | 
            +
                  if columns.is_a?(::String)
         | 
| 4098 4102 | 
             
                    columns = [columns]
         | 
| 4099 4103 | 
             
                  end
         | 
| 4100 4104 | 
             
                  _from_rbdf(_df.to_dummies(columns, separator, drop_first))
         | 
| @@ -4603,8 +4607,8 @@ module Polars | |
| 4603 4607 | 
             
                #   # │ 1   ┆ 5   │
         | 
| 4604 4608 | 
             
                #   # │ 3   ┆ 7   │
         | 
| 4605 4609 | 
             
                #   # └─────┴─────┘
         | 
| 4606 | 
            -
                def gather_every(n)
         | 
| 4607 | 
            -
                  select(Utils.col("*").gather_every(n))
         | 
| 4610 | 
            +
                def gather_every(n, offset = 0)
         | 
| 4611 | 
            +
                  select(Utils.col("*").gather_every(n, offset))
         | 
| 4608 4612 | 
             
                end
         | 
| 4609 4613 | 
             
                alias_method :take_every, :gather_every
         | 
| 4610 4614 |  | 
| @@ -4754,7 +4758,7 @@ module Polars | |
| 4754 4758 | 
             
                #   # │ bar    ┆ 2   ┆ b   ┆ null ┆ [3]       ┆ womp  │
         | 
| 4755 4759 | 
             
                #   # └────────┴─────┴─────┴──────┴───────────┴───────┘
         | 
| 4756 4760 | 
             
                def unnest(names)
         | 
| 4757 | 
            -
                  if names.is_a?(String)
         | 
| 4761 | 
            +
                  if names.is_a?(::String)
         | 
| 4758 4762 | 
             
                    names = [names]
         | 
| 4759 4763 | 
             
                  end
         | 
| 4760 4764 | 
             
                  _from_rbdf(_df.unnest(names))
         | 
| @@ -4867,10 +4871,10 @@ module Polars | |
| 4867 4871 | 
             
                        if val.is_a?(Hash) && dtype != Struct
         | 
| 4868 4872 | 
             
                          updated_data[name] = DataFrame.new(val).to_struct(name)
         | 
| 4869 4873 | 
             
                        elsif !Utils.arrlen(val).nil?
         | 
| 4870 | 
            -
                          updated_data[name] = Series.new(String.new(name), val, dtype: dtype)
         | 
| 4871 | 
            -
                        elsif val.nil? || [Integer, Float, TrueClass, FalseClass, String, ::Date, ::DateTime, ::Time].any? { |cls| val.is_a?(cls) }
         | 
| 4874 | 
            +
                          updated_data[name] = Series.new(::String.new(name), val, dtype: dtype)
         | 
| 4875 | 
            +
                        elsif val.nil? || [Integer, Float, TrueClass, FalseClass, ::String, ::Date, ::DateTime, ::Time].any? { |cls| val.is_a?(cls) }
         | 
| 4872 4876 | 
             
                          dtype = Polars::Float64 if val.nil? && dtype.nil?
         | 
| 4873 | 
            -
                          updated_data[name] = Series.new(String.new(name), [val], dtype: dtype).extend_constant(val, array_len - 1)
         | 
| 4877 | 
            +
                          updated_data[name] = Series.new(::String.new(name), [val], dtype: dtype).extend_constant(val, array_len - 1)
         | 
| 4874 4878 | 
             
                        else
         | 
| 4875 4879 | 
             
                          raise Todo
         | 
| 4876 4880 | 
             
                        end
         | 
| @@ -4927,7 +4931,7 @@ module Polars | |
| 4927 4931 | 
             
                  end
         | 
| 4928 4932 | 
             
                  column_names =
         | 
| 4929 4933 | 
             
                    (schema || []).map.with_index do |col, i|
         | 
| 4930 | 
            -
                      if col.is_a?(String)
         | 
| 4934 | 
            +
                      if col.is_a?(::String)
         | 
| 4931 4935 | 
             
                        col || "column_#{i}"
         | 
| 4932 4936 | 
             
                      else
         | 
| 4933 4937 | 
             
                        col[0]
         | 
| @@ -4940,7 +4944,7 @@ module Polars | |
| 4940 4944 | 
             
                  lookup = column_names.zip(lookup_names || []).to_h
         | 
| 4941 4945 |  | 
| 4942 4946 | 
             
                  column_dtypes =
         | 
| 4943 | 
            -
                    (schema || []).select { |col| !col.is_a?(String) && col[1] }.to_h do |col|
         | 
| 4947 | 
            +
                    (schema || []).select { |col| !col.is_a?(::String) && col[1] }.to_h do |col|
         | 
| 4944 4948 | 
             
                      [lookup[col[0]] || col[0], col[1]]
         | 
| 4945 4949 | 
             
                    end
         | 
| 4946 4950 |  | 
    
        data/lib/polars/data_types.rb
    CHANGED
    
    | @@ -120,9 +120,12 @@ module Polars | |
| 120 120 | 
             
              end
         | 
| 121 121 |  | 
| 122 122 | 
             
              # UTF-8 encoded string type.
         | 
| 123 | 
            -
              class  | 
| 123 | 
            +
              class String < DataType
         | 
| 124 124 | 
             
              end
         | 
| 125 125 |  | 
| 126 | 
            +
              # Allow Utf8 as an alias for String
         | 
| 127 | 
            +
              Utf8 = String
         | 
| 128 | 
            +
             | 
| 126 129 | 
             
              # Binary type.
         | 
| 127 130 | 
             
              class Binary < DataType
         | 
| 128 131 | 
             
              end
         | 
| @@ -365,7 +365,7 @@ module Polars | |
| 365 365 | 
             
                #   # ┌──────┐
         | 
| 366 366 | 
             
                #   # │ date │
         | 
| 367 367 | 
             
                #   # │ ---  │
         | 
| 368 | 
            -
                #   # │  | 
| 368 | 
            +
                #   # │ i8   │
         | 
| 369 369 | 
             
                #   # ╞══════╡
         | 
| 370 370 | 
             
                #   # │ 1    │
         | 
| 371 371 | 
             
                #   # │ 2    │
         | 
| @@ -407,7 +407,7 @@ module Polars | |
| 407 407 | 
             
                #   # ┌──────┐
         | 
| 408 408 | 
             
                #   # │ date │
         | 
| 409 409 | 
             
                #   # │ ---  │
         | 
| 410 | 
            -
                #   # │  | 
| 410 | 
            +
                #   # │ i8   │
         | 
| 411 411 | 
             
                #   # ╞══════╡
         | 
| 412 412 | 
             
                #   # │ 1    │
         | 
| 413 413 | 
             
                #   # │ 2    │
         | 
| @@ -449,7 +449,7 @@ module Polars | |
| 449 449 | 
             
                #   # ┌──────┐
         | 
| 450 450 | 
             
                #   # │ date │
         | 
| 451 451 | 
             
                #   # │ ---  │
         | 
| 452 | 
            -
                #   # │  | 
| 452 | 
            +
                #   # │ i8   │
         | 
| 453 453 | 
             
                #   # ╞══════╡
         | 
| 454 454 | 
             
                #   # │ 1    │
         | 
| 455 455 | 
             
                #   # │ 5    │
         | 
| @@ -496,7 +496,7 @@ module Polars | |
| 496 496 | 
             
                #   # ┌─────────┬──────────────┬─────────────┐
         | 
| 497 497 | 
             
                #   # │ weekday ┆ day_of_month ┆ day_of_year │
         | 
| 498 498 | 
             
                #   # │ ---     ┆ ---          ┆ ---         │
         | 
| 499 | 
            -
                #   # │  | 
| 499 | 
            +
                #   # │ i8      ┆ i8           ┆ i16         │
         | 
| 500 500 | 
             
                #   # ╞═════════╪══════════════╪═════════════╡
         | 
| 501 501 | 
             
                #   # │ 1       ┆ 1            ┆ 1           │
         | 
| 502 502 | 
             
                #   # │ 4       ┆ 4            ┆ 4           │
         | 
| @@ -544,7 +544,7 @@ module Polars | |
| 544 544 | 
             
                #   # ┌─────────┬──────────────┬─────────────┐
         | 
| 545 545 | 
             
                #   # │ weekday ┆ day_of_month ┆ day_of_year │
         | 
| 546 546 | 
             
                #   # │ ---     ┆ ---          ┆ ---         │
         | 
| 547 | 
            -
                #   # │  | 
| 547 | 
            +
                #   # │ i8      ┆ i8           ┆ i16         │
         | 
| 548 548 | 
             
                #   # ╞═════════╪══════════════╪═════════════╡
         | 
| 549 549 | 
             
                #   # │ 1       ┆ 1            ┆ 1           │
         | 
| 550 550 | 
             
                #   # │ 4       ┆ 4            ┆ 4           │
         | 
| @@ -592,7 +592,7 @@ module Polars | |
| 592 592 | 
             
                #   # ┌─────────┬──────────────┬─────────────┐
         | 
| 593 593 | 
             
                #   # │ weekday ┆ day_of_month ┆ day_of_year │
         | 
| 594 594 | 
             
                #   # │ ---     ┆ ---          ┆ ---         │
         | 
| 595 | 
            -
                #   # │  | 
| 595 | 
            +
                #   # │ i8      ┆ i8           ┆ i16         │
         | 
| 596 596 | 
             
                #   # ╞═════════╪══════════════╪═════════════╡
         | 
| 597 597 | 
             
                #   # │ 1       ┆ 1            ┆ 1           │
         | 
| 598 598 | 
             
                #   # │ 4       ┆ 4            ┆ 4           │
         | 
| @@ -654,7 +654,7 @@ module Polars | |
| 654 654 | 
             
                #   # ┌──────┐
         | 
| 655 655 | 
             
                #   # │ date │
         | 
| 656 656 | 
             
                #   # │ ---  │
         | 
| 657 | 
            -
                #   # │  | 
| 657 | 
            +
                #   # │ i8   │
         | 
| 658 658 | 
             
                #   # ╞══════╡
         | 
| 659 659 | 
             
                #   # │ 0    │
         | 
| 660 660 | 
             
                #   # │ 12   │
         | 
| @@ -695,7 +695,7 @@ module Polars | |
| 695 695 | 
             
                #   # ┌──────┐
         | 
| 696 696 | 
             
                #   # │ date │
         | 
| 697 697 | 
             
                #   # │ ---  │
         | 
| 698 | 
            -
                #   # │  | 
| 698 | 
            +
                #   # │ i8   │
         | 
| 699 699 | 
             
                #   # ╞══════╡
         | 
| 700 700 | 
             
                #   # │ 0    │
         | 
| 701 701 | 
             
                #   # │ 2    │
         | 
| @@ -744,7 +744,7 @@ module Polars | |
| 744 744 | 
             
                #   # ┌──────┐
         | 
| 745 745 | 
             
                #   # │ secs │
         | 
| 746 746 | 
             
                #   # │ ---  │
         | 
| 747 | 
            -
                #   # │  | 
| 747 | 
            +
                #   # │ i8   │
         | 
| 748 748 | 
             
                #   # ╞══════╡
         | 
| 749 749 | 
             
                #   # │ 0    │
         | 
| 750 750 | 
             
                #   # │ 3    │
         | 
| @@ -789,7 +789,7 @@ module Polars | |
| 789 789 | 
             
                #   # ┌──────┐
         | 
| 790 790 | 
             
                #   # │ date │
         | 
| 791 791 | 
             
                #   # │ ---  │
         | 
| 792 | 
            -
                #   # │  | 
| 792 | 
            +
                #   # │ i8   │
         | 
| 793 793 | 
             
                #   # ╞══════╡
         | 
| 794 794 | 
             
                #   # │ 0    │
         | 
| 795 795 | 
             
                #   # │ 2    │
         | 
| @@ -220,7 +220,7 @@ module Polars | |
| 220 220 | 
             
                #   date.dt.quarter
         | 
| 221 221 | 
             
                #   # =>
         | 
| 222 222 | 
             
                #   # shape: (4,)
         | 
| 223 | 
            -
                #   # Series: '' [ | 
| 223 | 
            +
                #   # Series: '' [i8]
         | 
| 224 224 | 
             
                #   # [
         | 
| 225 225 | 
             
                #   #         1
         | 
| 226 226 | 
             
                #   #         1
         | 
| @@ -258,7 +258,7 @@ module Polars | |
| 258 258 | 
             
                #   date.dt.month
         | 
| 259 259 | 
             
                #   # =>
         | 
| 260 260 | 
             
                #   # shape: (4,)
         | 
| 261 | 
            -
                #   # Series: '' [ | 
| 261 | 
            +
                #   # Series: '' [i8]
         | 
| 262 262 | 
             
                #   # [
         | 
| 263 263 | 
             
                #   #         1
         | 
| 264 264 | 
             
                #   #         2
         | 
| @@ -296,7 +296,7 @@ module Polars | |
| 296 296 | 
             
                #   date.dt.week
         | 
| 297 297 | 
             
                #   # =>
         | 
| 298 298 | 
             
                #   # shape: (4,)
         | 
| 299 | 
            -
                #   # Series: '' [ | 
| 299 | 
            +
                #   # Series: '' [i8]
         | 
| 300 300 | 
             
                #   # [
         | 
| 301 301 | 
             
                #   #         1
         | 
| 302 302 | 
             
                #   #         5
         | 
| @@ -336,7 +336,7 @@ module Polars | |
| 336 336 | 
             
                #   date.dt.weekday
         | 
| 337 337 | 
             
                #   # =>
         | 
| 338 338 | 
             
                #   # shape: (7,)
         | 
| 339 | 
            -
                #   # Series: '' [ | 
| 339 | 
            +
                #   # Series: '' [i8]
         | 
| 340 340 | 
             
                #   # [
         | 
| 341 341 | 
             
                #   #         1
         | 
| 342 342 | 
             
                #   #         2
         | 
| @@ -378,7 +378,7 @@ module Polars | |
| 378 378 | 
             
                #   date.dt.day
         | 
| 379 379 | 
             
                #   # =>
         | 
| 380 380 | 
             
                #   # shape: (5,)
         | 
| 381 | 
            -
                #   # Series: '' [ | 
| 381 | 
            +
                #   # Series: '' [i8]
         | 
| 382 382 | 
             
                #   # [
         | 
| 383 383 | 
             
                #   #         1
         | 
| 384 384 | 
             
                #   #         3
         | 
| @@ -416,7 +416,7 @@ module Polars | |
| 416 416 | 
             
                #   date.dt.ordinal_day
         | 
| 417 417 | 
             
                #   # =>
         | 
| 418 418 | 
             
                #   # shape: (3,)
         | 
| 419 | 
            -
                #   # Series: '' [ | 
| 419 | 
            +
                #   # Series: '' [i16]
         | 
| 420 420 | 
             
                #   # [
         | 
| 421 421 | 
             
                #   #         1
         | 
| 422 422 | 
             
                #   #         32
         | 
| @@ -452,7 +452,7 @@ module Polars | |
| 452 452 | 
             
                #   date.dt.hour
         | 
| 453 453 | 
             
                #   # =>
         | 
| 454 454 | 
             
                #   # shape: (4,)
         | 
| 455 | 
            -
                #   # Series: '' [ | 
| 455 | 
            +
                #   # Series: '' [i8]
         | 
| 456 456 | 
             
                #   # [
         | 
| 457 457 | 
             
                #   #         0
         | 
| 458 458 | 
             
                #   #         1
         | 
| @@ -488,7 +488,7 @@ module Polars | |
| 488 488 | 
             
                #   date.dt.minute
         | 
| 489 489 | 
             
                #   # =>
         | 
| 490 490 | 
             
                #   # shape: (3,)
         | 
| 491 | 
            -
                #   # Series: '' [ | 
| 491 | 
            +
                #   # Series: '' [i8]
         | 
| 492 492 | 
             
                #   # [
         | 
| 493 493 | 
             
                #   #         0
         | 
| 494 494 | 
             
                #   #         2
         | 
| @@ -531,7 +531,7 @@ module Polars | |
| 531 531 | 
             
                #   date.dt.second
         | 
| 532 532 | 
             
                #   # =>
         | 
| 533 533 | 
             
                #   # shape: (9,)
         | 
| 534 | 
            -
                #   # Series: '' [ | 
| 534 | 
            +
                #   # Series: '' [i8]
         | 
| 535 535 | 
             
                #   # [
         | 
| 536 536 | 
             
                #   #         0
         | 
| 537 537 | 
             
                #   #         0
         | 
| @@ -593,7 +593,7 @@ module Polars | |
| 593 593 | 
             
                #   date.dt.millisecond
         | 
| 594 594 | 
             
                #   # =>
         | 
| 595 595 | 
             
                #   # shape: (9,)
         | 
| 596 | 
            -
                #   # Series: '' [ | 
| 596 | 
            +
                #   # Series: '' [i32]
         | 
| 597 597 | 
             
                #   # [
         | 
| 598 598 | 
             
                #   #         0
         | 
| 599 599 | 
             
                #   #         500
         | 
| @@ -638,7 +638,7 @@ module Polars | |
| 638 638 | 
             
                #   date.dt.microsecond
         | 
| 639 639 | 
             
                #   # =>
         | 
| 640 640 | 
             
                #   # shape: (9,)
         | 
| 641 | 
            -
                #   # Series: '' [ | 
| 641 | 
            +
                #   # Series: '' [i32]
         | 
| 642 642 | 
             
                #   # [
         | 
| 643 643 | 
             
                #   #         0
         | 
| 644 644 | 
             
                #   #         500000
         | 
| @@ -683,7 +683,7 @@ module Polars | |
| 683 683 | 
             
                #   date.dt.nanosecond
         | 
| 684 684 | 
             
                #   # =>
         | 
| 685 685 | 
             
                #   # shape: (9,)
         | 
| 686 | 
            -
                #   # Series: '' [ | 
| 686 | 
            +
                #   # Series: '' [i32]
         | 
| 687 687 | 
             
                #   # [
         | 
| 688 688 | 
             
                #   #         0
         | 
| 689 689 | 
             
                #   #         500000000
         |