Skip to content

Commit 47e47a2

Browse files
committed
Merge remote-tracking branch 'upstream/main' into read-csv-from-directory
2 parents 6ccbc91 + 3550556 commit 47e47a2

File tree

3 files changed

+14
-17
lines changed

3 files changed

+14
-17
lines changed

doc/source/user_guide/io.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5432,7 +5432,7 @@ A simple example loading all data from an Iceberg table ``my_table`` defined in
54325432
df = pd.read_iceberg("my_table", catalog_name="my_catalog")
54335433
54345434
Catalogs must be defined in the ``.pyiceberg.yaml`` file, usually in the home directory.
5435-
It is possible to to change properties of the catalog definition with the
5435+
It is possible to change properties of the catalog definition with the
54365436
``catalog_properties`` parameter:
54375437

54385438
.. code-block:: python

pandas/compat/pickle_compat.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
"pandas._libs.internals",
3737
"_unpickle_block",
3838
),
39-
# Avoid Cython's warning "contradiction to to Python 'class private name' rules"
39+
# Avoid Cython's warning "contradiction to Python 'class private name' rules"
4040
("pandas._libs.tslibs.nattype", "__nat_unpickle"): (
4141
"pandas._libs.tslibs.nattype",
4242
"_nat_unpickle",

pandas/tests/base/test_misc.py

Lines changed: 12 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,9 @@
33
import numpy as np
44
import pytest
55

6-
from pandas._config import using_string_dtype
7-
86
from pandas.compat import PYPY
97

108
from pandas.core.dtypes.common import (
11-
is_dtype_equal,
129
is_object_dtype,
1310
)
1411

@@ -81,10 +78,7 @@ def test_ndarray_compat_properties(index_or_series_obj):
8178
assert Series([1]).item() == 1
8279

8380

84-
@pytest.mark.skipif(
85-
PYPY or using_string_dtype(),
86-
reason="not relevant for PyPy doesn't work properly for arrow strings",
87-
)
81+
@pytest.mark.skipif(PYPY, reason="not relevant for PyPy")
8882
def test_memory_usage(index_or_series_memory_obj):
8983
obj = index_or_series_memory_obj
9084
# Clear index caches so that len(obj) == 0 report 0 memory usage
@@ -98,18 +92,21 @@ def test_memory_usage(index_or_series_memory_obj):
9892
res = obj.memory_usage()
9993
res_deep = obj.memory_usage(deep=True)
10094

101-
is_object = is_object_dtype(obj) or (is_ser and is_object_dtype(obj.index))
102-
is_categorical = isinstance(obj.dtype, pd.CategoricalDtype) or (
103-
is_ser and isinstance(obj.index.dtype, pd.CategoricalDtype)
104-
)
105-
is_object_string = is_dtype_equal(obj, "string[python]") or (
106-
is_ser and is_dtype_equal(obj.index.dtype, "string[python]")
107-
)
95+
def _is_object_dtype(obj):
96+
if isinstance(obj, pd.MultiIndex):
97+
return any(_is_object_dtype(level) for level in obj.levels)
98+
elif isinstance(obj.dtype, pd.CategoricalDtype):
99+
return _is_object_dtype(obj.dtype.categories)
100+
elif isinstance(obj.dtype, pd.StringDtype):
101+
return obj.dtype.storage == "python"
102+
return is_object_dtype(obj)
103+
104+
has_objects = _is_object_dtype(obj) or (is_ser and _is_object_dtype(obj.index))
108105

109106
if len(obj) == 0:
110107
expected = 0
111108
assert res_deep == res == expected
112-
elif is_object or is_categorical or is_object_string:
109+
elif has_objects:
113110
# only deep will pick them up
114111
assert res_deep > res
115112
else:

0 commit comments

Comments
 (0)