Skip to content

Commit

Permalink
apacheGH-15070: [Python][CI] Update pandas test for empty columns dty…
Browse files Browse the repository at this point in the history
…pe 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 <jorisvandenbossche@gmail.com>
Signed-off-by: Sutou Kouhei <kou@clear-code.com>
  • Loading branch information
jorisvandenbossche authored and ArgusLi committed May 15, 2023
1 parent beba2fa commit bcb0ece
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions python/pyarrow/tests/test_pandas.py
Original file line number Diff line number Diff line change
Expand Up @@ -2828,8 +2828,12 @@ def test_partial_schema(self):

def test_table_batch_empty_dataframe(self):
df = pd.DataFrame({})
_check_pandas_roundtrip(df)
_check_pandas_roundtrip(df, as_batch=True)
_check_pandas_roundtrip(df, preserve_index=None)
_check_pandas_roundtrip(df, preserve_index=None, as_batch=True)

expected = pd.DataFrame(columns=pd.Index([]))
_check_pandas_roundtrip(df, expected, preserve_index=False)
_check_pandas_roundtrip(df, expected, preserve_index=False, as_batch=True)

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

0 comments on commit bcb0ece

Please sign in to comment.