Skip to content

Commit

Permalink
feat(pandas): support Table.sample
Browse files Browse the repository at this point in the history
  • Loading branch information
jcrist committed Oct 17, 2023
1 parent f3d044c commit 77215be
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
5 changes: 5 additions & 0 deletions ibis/backends/pandas/execution/generic.py
Original file line number Diff line number Diff line change
Expand Up @@ -1450,3 +1450,8 @@ def execute_table_array_view(op, _, **kwargs):
@execute_node.register(ops.InMemoryTable)
def execute_in_memory_table(op, **kwargs):
return op.data.to_frame()


@execute_node.register(ops.Sample, pd.DataFrame, object, object)
def execute_sample(op, data, fraction, seed, **kwargs):
return data.sample(frac=fraction, random_state=seed)
3 changes: 0 additions & 3 deletions ibis/backends/tests/test_generic.py
Original file line number Diff line number Diff line change
Expand Up @@ -1537,7 +1537,6 @@ def test_dynamic_table_slice_with_computed_offset(backend):
"druid",
"flink",
"impala",
"pandas",
"polars",
"pyspark",
"snowflake",
Expand Down Expand Up @@ -1566,7 +1565,6 @@ def test_sample(backend):
"druid",
"flink",
"impala",
"pandas",
"polars",
"pyspark",
"snowflake",
Expand All @@ -1591,7 +1589,6 @@ def test_sample_memtable(con, backend):
"mssql",
"mysql",
"oracle",
"pandas",
"polars",
"postgres",
"pyspark",
Expand Down

0 comments on commit 77215be

Please sign in to comment.