Skip to content

Commit dd96604

Browse files
Merge remote-tracking branch 'upstream/2.3.x' into string-dtype-2.3.x-downcast-string
2 parents 2c0c5b1 + ffe0791 commit dd96604

File tree

5 files changed

+10
-7
lines changed

5 files changed

+10
-7
lines changed

.circleci/config.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ jobs:
1515
- checkout
1616
- run: .circleci/setup_env.sh
1717
- run: |
18-
sudo apt-get update && sudo apt-get install -y libegl1 libopengl0
1918
PATH=$HOME/miniconda3/envs/pandas-dev/bin:$HOME/miniconda3/condabin:$PATH \
2019
LD_PRELOAD=$HOME/miniconda3/envs/pandas-dev/lib/libgomp.so.1:$LD_PRELOAD \
2120
ci/run_tests.sh

pandas/core/dtypes/cast.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1606,7 +1606,10 @@ def construct_1d_object_array_from_listlike(values: Collection) -> np.ndarray:
16061606
"""
16071607
# numpy will try to interpret nested lists as further dimensions in np.array(),
16081608
# hence explicitly making a 1D array using np.fromiter
1609-
return np.fromiter(values, dtype="object", count=len(values))
1609+
result = np.empty(len(values), dtype="object")
1610+
for i, obj in enumerate(values):
1611+
result[i] = obj
1612+
return result
16101613

16111614

16121615
def maybe_cast_to_integer_array(arr: list | np.ndarray, dtype: np.dtype) -> np.ndarray:

pandas/tests/extension/test_arrow.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1637,7 +1637,7 @@ def test_from_arrow_respecting_given_dtype():
16371637

16381638
def test_from_arrow_respecting_given_dtype_unsafe():
16391639
array = pa.array([1.5, 2.5], type=pa.float64())
1640-
with pytest.raises(pa.ArrowInvalid, match="Float value 1.5 was truncated"):
1640+
with tm.external_error_raised(pa.ArrowInvalid):
16411641
array.to_pandas(types_mapper={pa.float64(): ArrowDtype(pa.int64())}.get)
16421642

16431643

pandas/tests/io/test_fsspec.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55

66
from pandas._config import using_string_dtype
77

8+
from pandas.compat import HAS_PYARROW
9+
810
from pandas import (
911
DataFrame,
1012
date_range,
@@ -168,7 +170,9 @@ def test_excel_options(fsspectest):
168170
assert fsspectest.test[0] == "read"
169171

170172

171-
@pytest.mark.xfail(using_string_dtype(), reason="TODO(infer_string) fastparquet")
173+
@pytest.mark.xfail(
174+
using_string_dtype() and HAS_PYARROW, reason="TODO(infer_string) fastparquet"
175+
)
172176
def test_to_parquet_new_file(cleared_fs, df1):
173177
"""Regression test for writing to a not-yet-existent GCS Parquet file."""
174178
pytest.importorskip("fastparquet")

pandas/tests/io/test_gcs.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,6 @@
77
import numpy as np
88
import pytest
99

10-
from pandas._config import using_string_dtype
11-
1210
from pandas.compat.pyarrow import pa_version_under17p0
1311

1412
from pandas import (
@@ -196,7 +194,6 @@ def test_to_csv_compression_encoding_gcs(
196194
tm.assert_frame_equal(df, read_df)
197195

198196

199-
@pytest.mark.xfail(using_string_dtype(), reason="TODO(infer_string) fastparquet")
200197
def test_to_parquet_gcs_new_file(monkeypatch, tmpdir):
201198
"""Regression test for writing to a not-yet-existent GCS Parquet file."""
202199
pytest.importorskip("fastparquet")

0 commit comments

Comments
 (0)