Skip to content

Commit ddc0469

Browse files
committed
Merge branch 'main' into ref-stringarray
2 parents 62ea5fc + d36c589 commit ddc0469

File tree

8 files changed

+29
-12
lines changed

8 files changed

+29
-12
lines changed

ci/code_checks.sh

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,6 @@ if [[ -z "$CHECK" || "$CHECK" == "docstrings" ]]; then
239239
-i "pandas.api.extensions.ExtensionArray.view SA01" \
240240
-i "pandas.api.interchange.from_dataframe RT03,SA01" \
241241
-i "pandas.api.types.is_bool PR01,SA01" \
242-
-i "pandas.api.types.is_bool_dtype SA01" \
243242
-i "pandas.api.types.is_categorical_dtype SA01" \
244243
-i "pandas.api.types.is_complex PR01,SA01" \
245244
-i "pandas.api.types.is_complex_dtype SA01" \

pandas/core/dtypes/common.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1274,6 +1274,10 @@ def is_bool_dtype(arr_or_dtype) -> bool:
12741274
"""
12751275
Check whether the provided array or dtype is of a boolean dtype.
12761276
1277+
This function verifies whether a given object is a boolean data type. The input
1278+
can be an array or a dtype object. Accepted array types include instances
1279+
of ``np.array``, ``pd.Series``, ``pd.Index``, and similar array-like structures.
1280+
12771281
Parameters
12781282
----------
12791283
arr_or_dtype : array-like or dtype
@@ -1284,6 +1288,10 @@ def is_bool_dtype(arr_or_dtype) -> bool:
12841288
boolean
12851289
Whether or not the array or dtype is of a boolean dtype.
12861290
1291+
See Also
1292+
--------
1293+
api.types.is_bool : Check if an object is a boolean.
1294+
12871295
Notes
12881296
-----
12891297
An ExtensionArray is considered boolean when the ``_is_boolean``

pandas/tests/io/excel/test_readers.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -712,7 +712,9 @@ def test_dtype_backend_string(self, read_ext, string_storage, tmp_excel):
712712
"b": Series(["x", None], dtype=pd.StringDtype(string_storage)),
713713
}
714714
)
715-
tm.assert_frame_equal(result, expected)
715+
# the storage of the str columns' Index is also affected by the
716+
# string_storage setting -> ignore that for checking the result
717+
tm.assert_frame_equal(result, expected, check_column_type=False)
716718

717719
@pytest.mark.parametrize("dtypes, exp_value", [({}, 1), ({"a.1": "int64"}, 1)])
718720
def test_dtype_mangle_dup_cols(self, read_ext, dtypes, exp_value):

pandas/tests/io/json/test_pandas.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2194,7 +2194,9 @@ def test_read_json_dtype_backend(
21942194
if orient == "values":
21952195
expected.columns = list(range(8))
21962196

2197-
tm.assert_frame_equal(result, expected)
2197+
# the storage of the str columns' Index is also affected by the
2198+
# string_storage setting -> ignore that for checking the result
2199+
tm.assert_frame_equal(result, expected, check_column_type=False)
21982200

21992201
@pytest.mark.parametrize("orient", ["split", "records", "index"])
22002202
def test_read_json_nullable_series(self, string_storage, dtype_backend, orient):

pandas/tests/io/parser/dtypes/test_dtypes_basic.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -470,12 +470,12 @@ def test_dtype_backend_string(all_parsers, string_storage):
470470
"""
471471
result = parser.read_csv(StringIO(data), dtype_backend="numpy_nullable")
472472

473-
expected = DataFrame(
474-
{
475-
"a": pd.array(["a", "b"], dtype=pd.StringDtype(string_storage)),
476-
"b": pd.array(["x", pd.NA], dtype=pd.StringDtype(string_storage)),
477-
}
478-
)
473+
expected = DataFrame(
474+
{
475+
"a": pd.array(["a", "b"], dtype=pd.StringDtype(string_storage)),
476+
"b": pd.array(["x", pd.NA], dtype=pd.StringDtype(string_storage)),
477+
},
478+
)
479479
tm.assert_frame_equal(result, expected)
480480

481481

pandas/tests/io/parser/test_read_fwf.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -974,7 +974,9 @@ def test_dtype_backend(string_storage, dtype_backend):
974974
)
975975
expected["i"] = ArrowExtensionArray(pa.array([None, None]))
976976

977-
tm.assert_frame_equal(result, expected)
977+
# the storage of the str columns' Index is also affected by the
978+
# string_storage setting -> ignore that for checking the result
979+
tm.assert_frame_equal(result, expected, check_column_type=False)
978980

979981

980982
def test_invalid_dtype_backend():

pandas/tests/io/test_html.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,9 @@ def test_dtype_backend(self, string_storage, dtype_backend, flavor_read_html):
207207
}
208208
)
209209

210-
tm.assert_frame_equal(result, expected)
210+
# the storage of the str columns' Index is also affected by the
211+
# string_storage setting -> ignore that for checking the result
212+
tm.assert_frame_equal(result, expected, check_column_type=False)
211213

212214
@pytest.mark.network
213215
@pytest.mark.single_cpu

pandas/tests/io/xml/test_xml.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2050,7 +2050,9 @@ def test_read_xml_nullable_dtypes(
20502050
)
20512051
expected["g"] = ArrowExtensionArray(pa.array([None, None]))
20522052

2053-
tm.assert_frame_equal(result, expected)
2053+
# the storage of the str columns' Index is also affected by the
2054+
# string_storage setting -> ignore that for checking the result
2055+
tm.assert_frame_equal(result, expected, check_column_type=False)
20542056

20552057

20562058
def test_invalid_dtype_backend():

0 commit comments

Comments
 (0)