Skip to content

Commit 3de97a2

Browse files
jorisvandenbosschertpsw
authored andcommitted
apacheGH-15070: [Python][CI] Update pandas test for empty columns dtype change in pandas 2.0.1 (apache#35031)
### Rationale for this change Pandas changed the default dtype of the columns object for an empty DataFrame from object dtype to integer RangeIndex (see pandas-dev/pandas#52404). This updates our tests to pass with that change. * Closes: apache#15070 Authored-by: Joris Van den Bossche <[email protected]> Signed-off-by: Sutou Kouhei <[email protected]>
1 parent d40ea10 commit 3de97a2

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

python/pyarrow/tests/test_pandas.py

+6-2
Original file line numberDiff line numberDiff line change
@@ -2828,8 +2828,12 @@ def test_partial_schema(self):
28282828

28292829
def test_table_batch_empty_dataframe(self):
28302830
df = pd.DataFrame({})
2831-
_check_pandas_roundtrip(df)
2832-
_check_pandas_roundtrip(df, as_batch=True)
2831+
_check_pandas_roundtrip(df, preserve_index=None)
2832+
_check_pandas_roundtrip(df, preserve_index=None, as_batch=True)
2833+
2834+
expected = pd.DataFrame(columns=pd.Index([]))
2835+
_check_pandas_roundtrip(df, expected, preserve_index=False)
2836+
_check_pandas_roundtrip(df, expected, preserve_index=False, as_batch=True)
28332837

28342838
df2 = pd.DataFrame({}, index=[0, 1, 2])
28352839
_check_pandas_roundtrip(df2, preserve_index=True)

0 commit comments

Comments
 (0)