Skip to content

Commit 478086a

Browse files
committed
test: add test for describe method with mixed numeric and string columns
1 parent a77e129 commit 478086a

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

python/tests/test_dataframe.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1870,6 +1870,20 @@ def test_describe(df):
18701870
}
18711871

18721872

1873+
def test_describe_mixed_numeric_string():
1874+
ctx = SessionContext()
1875+
batch = pa.RecordBatch.from_arrays(
1876+
[pa.array([1, 2, 3]), pa.array(["x", "y", "z"])],
1877+
names=["a", "b"],
1878+
)
1879+
df = ctx.from_arrow(batch)
1880+
result = df.describe().to_pydict()
1881+
assert result["a"][2] == 2.0
1882+
assert result["b"][2] in (None, "null")
1883+
assert result["b"][3] in (None, "null")
1884+
assert result["b"][6] in (None, "null")
1885+
1886+
18731887
@pytest.mark.parametrize("path_to_str", [True, False])
18741888
def test_write_csv(ctx, df, tmp_path, path_to_str):
18751889
path = str(tmp_path) if path_to_str else tmp_path

0 commit comments

Comments
 (0)