Skip to content

Commit

Permalink
Improved I/O code [skip ci]
Browse files Browse the repository at this point in the history
  • Loading branch information
ankane committed May 22, 2024
1 parent 5019b4e commit d1213c1
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 12 deletions.
7 changes: 6 additions & 1 deletion lib/polars/convert.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
11 changes: 0 additions & 11 deletions lib/polars/data_frame.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down

0 comments on commit d1213c1

Please sign in to comment.