Skip to content

Commit 82ddeb5

Browse files
author
Kei
committed
Seperate tests
1 parent 932d737 commit 82ddeb5

File tree

1 file changed

+18
-9
lines changed

1 file changed

+18
-9
lines changed

pandas/tests/groupby/aggregate/test_aggregate.py

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1883,10 +1883,9 @@ def test_agg_lambda_pyarrow_to_same_data_type():
18831883
assert result["B"].dtype == expected["B"].dtype
18841884

18851885

1886-
def test_agg_lambda_pyarrow_to_data_type_conversion():
1887-
# test numpy datatype conversion back to pyarrow datatype
1886+
def test_agg_lambda_float64_pyarrow_dtype_conversion():
1887+
# test numpy dtype conversion back to pyarrow dtype
18881888
# complexes, floats, ints, uints, object
1889-
# float64
18901889
df = DataFrame({"A": ["c1", "c2", "c3"], "B": [100, 200, 255]})
18911890
df["B"] = df["B"].astype("float64[pyarrow]")
18921891
gb = df.groupby("A")
@@ -1899,7 +1898,9 @@ def test_agg_lambda_pyarrow_to_data_type_conversion():
18991898
tm.assert_frame_equal(result, expected)
19001899
assert result["B"].dtype == expected["B"].dtype
19011900

1902-
# complex128
1901+
1902+
def test_agg_lambda_complex128_pyarrow_dtype_conversion():
1903+
df = DataFrame({"A": ["c1", "c2", "c3"], "B": [100, 200, 255]})
19031904
df["B"] = df["B"].astype("int64[pyarrow]")
19041905
gb = df.groupby("A")
19051906
result = gb.agg(lambda x: complex(x.sum(), x.count()))
@@ -1916,7 +1917,8 @@ def test_agg_lambda_pyarrow_to_data_type_conversion():
19161917
tm.assert_frame_equal(result, expected)
19171918
assert result["B"].dtype == expected["B"].dtype
19181919

1919-
# int64
1920+
1921+
def test_agg_lambda_int64_pyarrow_dtype_conversion():
19201922
df = DataFrame({"A": ["c1", "c2", "c3"], "B": [100, 200, 255]})
19211923
df["B"] = df["B"].astype("int64[pyarrow]")
19221924
gb = df.groupby("A")
@@ -1929,7 +1931,8 @@ def test_agg_lambda_pyarrow_to_data_type_conversion():
19291931
tm.assert_frame_equal(result, expected)
19301932
assert result["B"].dtype == expected["B"].dtype
19311933

1932-
# uint64
1934+
1935+
def test_agg_lambda_uint64_pyarrow_dtype_conversion():
19331936
df = DataFrame({"A": ["c1", "c2", "c3"], "B": [100, 200, 255]})
19341937
df["B"] = df["B"].astype("uint64[pyarrow]")
19351938
gb = df.groupby("A")
@@ -1939,7 +1942,11 @@ def test_agg_lambda_pyarrow_to_data_type_conversion():
19391942
expected["B"] = expected["B"].astype("int64[pyarrow]")
19401943
expected.set_index("A", inplace=True)
19411944

1942-
# uint64 casted
1945+
tm.assert_frame_equal(result, expected)
1946+
assert result["B"].dtype == expected["B"].dtype
1947+
1948+
1949+
def test_agg_lambda_numpy_uint64_to_pyarrow_dtype_conversion():
19431950
df = DataFrame({"A": ["c1", "c2", "c3"], "B": [100, 200, 255]})
19441951
df["B"] = df["B"].astype("uint64[pyarrow]")
19451952
gb = df.groupby("A")
@@ -1952,7 +1959,8 @@ def test_agg_lambda_pyarrow_to_data_type_conversion():
19521959
tm.assert_frame_equal(result, expected)
19531960
assert result["B"].dtype == expected["B"].dtype
19541961

1955-
# bool
1962+
1963+
def test_agg_lambda_bool_pyarrow_dtype_conversion():
19561964
df = DataFrame({"A": ["c1", "c2", "c3"], "B": [100, 200, 255]})
19571965
df["B"] = df["B"].astype("bool[pyarrow]")
19581966
gb = df.groupby("A")
@@ -1965,7 +1973,8 @@ def test_agg_lambda_pyarrow_to_data_type_conversion():
19651973
tm.assert_frame_equal(result, expected)
19661974
assert result["B"].dtype == expected["B"].dtype
19671975

1968-
# object
1976+
1977+
def test_agg_lambda_object_pyarrow_dtype_conversion():
19691978
df = DataFrame({"A": ["c1", "c2", "c3"], "B": [100, 200, 255]})
19701979
df["B"] = df["B"].astype("int64[pyarrow]")
19711980
gb = df.groupby("A")

0 commit comments

Comments
 (0)