From d1213c129a3b25aac7d650580c89529659a3f765 Mon Sep 17 00:00:00 2001 From: Andrew Kane Date: Wed, 22 May 2024 19:25:21 -0400 Subject: [PATCH] Improved I/O code [skip ci] --- lib/polars/convert.rb | 7 ++++++- lib/polars/data_frame.rb | 11 ----------- 2 files changed, 6 insertions(+), 12 deletions(-) diff --git a/lib/polars/convert.rb b/lib/polars/convert.rb index b4ba07d45f..02d0c934e6 100644 --- a/lib/polars/convert.rb +++ b/lib/polars/convert.rb @@ -27,7 +27,12 @@ module Convert # # │ 2 ┆ 4 │ # # └─────┴─────┘ def from_hash(data, schema: nil, columns: nil) - DataFrame._from_hash(data, schema: schema || columns) + Utils.wrap_df( + DataFrame.hash_to_rbdf( + data, + schema: schema || columns + ) + ) end # Construct a DataFrame from a sequence of dictionaries. This operation clones data. diff --git a/lib/polars/data_frame.rb b/lib/polars/data_frame.rb index b15a087fec..6aef49a514 100644 --- a/lib/polars/data_frame.rb +++ b/lib/polars/data_frame.rb @@ -46,17 +46,6 @@ def self._from_rbdf(rb_df) df end - # @private - def self._from_hashes(data, infer_schema_length: 100, schema: nil, schema_overrides: nil) - rbdf = RbDataFrame.from_hashes(data, schema, schema_overrides, false, infer_schema_length) - _from_rbdf(rbdf) - end - - # @private - def self._from_hash(data, schema: nil, schema_overrides: nil) - _from_rbdf(hash_to_rbdf(data, schema: schema, schema_overrides: schema_overrides)) - end - # Get the shape of the DataFrame. # # @return [Array]