Skip to content

Commit b00eb77

Browse files
committed
Merge branch 'master' of github.com:pandas-dev/pandas into depr/CategoricalAccessor-categorical-name-index
2 parents ca69519 + 6d3565a commit b00eb77

23 files changed

+451
-317
lines changed

ci/code_checks.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ if [[ -z "$CHECK" || "$CHECK" == "lint" ]]; then
101101

102102
# Imports - Check formatting using isort see setup.cfg for settings
103103
MSG='Check import format using isort ' ; echo $MSG
104-
isort --recursive --check-only pandas
104+
isort --recursive --check-only pandas asv_bench
105105
RET=$(($RET + $?)) ; echo $MSG "DONE"
106106

107107
fi

doc/source/api/general_utility_functions.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ Dtype introspection
6363
api.types.is_datetime64_ns_dtype
6464
api.types.is_datetime64tz_dtype
6565
api.types.is_extension_type
66+
api.types.is_extension_array_dtype
6667
api.types.is_float_dtype
6768
api.types.is_int64_dtype
6869
api.types.is_integer_dtype

doc/source/whatsnew/v0.24.0.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1791,6 +1791,7 @@ I/O
17911791
- Bug in :meth:`DataFrame.to_dict` when the resulting dict contains non-Python scalars in the case of numeric data (:issue:`23753`)
17921792
- :func:`DataFrame.to_string()`, :func:`DataFrame.to_html()`, :func:`DataFrame.to_latex()` will correctly format output when a string is passed as the ``float_format`` argument (:issue:`21625`, :issue:`22270`)
17931793
- Bug in :func:`read_csv` that caused it to raise ``OverflowError`` when trying to use 'inf' as ``na_value`` with integer index column (:issue:`17128`)
1794+
- Bug in :func:`read_csv` that caused the C engine on Python 3.6+ on Windows to improperly read CSV filenames with accented or special characters (:issue:`15086`)
17941795
- Bug in :func:`read_fwf` in which the compression type of a file was not being properly inferred (:issue:`22199`)
17951796
- Bug in :func:`pandas.io.json.json_normalize` that caused it to raise ``TypeError`` when two consecutive elements of ``record_path`` are dicts (:issue:`22706`)
17961797
- Bug in :meth:`DataFrame.to_stata`, :class:`pandas.io.stata.StataWriter` and :class:`pandas.io.stata.StataWriter117` where a exception would leave a partially written and invalid dta file (:issue:`23573`)

environment.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ dependencies:
1414
- cython>=0.28.2
1515
- flake8
1616
- flake8-comprehensions
17-
- flake8-rst>=0.6.0
17+
- flake8-rst>=0.6.0,<=0.7.0
1818
- gitpython
1919
- hypothesis>=3.82
2020
- isort

pandas/_libs/parsers.pyx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -677,7 +677,13 @@ cdef class TextReader:
677677

678678
if isinstance(source, basestring):
679679
if not isinstance(source, bytes):
680-
source = source.encode(sys.getfilesystemencoding() or 'utf-8')
680+
if compat.PY36 and compat.is_platform_windows():
681+
# see gh-15086.
682+
encoding = "mbcs"
683+
else:
684+
encoding = sys.getfilesystemencoding() or "utf-8"
685+
686+
source = source.encode(encoding)
681687

682688
if self.memory_map:
683689
ptr = new_mmap(source)

pandas/_libs/tslibs/offsets.pyx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -412,12 +412,12 @@ class _BaseOffset(object):
412412
**self.kwds)
413413

414414
def __neg__(self):
415-
# Note: we are defering directly to __mul__ instead of __rmul__, as
415+
# Note: we are deferring directly to __mul__ instead of __rmul__, as
416416
# that allows us to use methods that can go in a `cdef class`
417417
return self * -1
418418

419419
def copy(self):
420-
# Note: we are defering directly to __mul__ instead of __rmul__, as
420+
# Note: we are deferring directly to __mul__ instead of __rmul__, as
421421
# that allows us to use methods that can go in a `cdef class`
422422
return self * 1
423423

pandas/core/dtypes/api.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@
55
is_categorical_dtype, is_complex, is_complex_dtype,
66
is_datetime64_any_dtype, is_datetime64_dtype, is_datetime64_ns_dtype,
77
is_datetime64tz_dtype, is_datetimetz, is_dict_like, is_dtype_equal,
8-
is_extension_type, is_file_like, is_float, is_float_dtype, is_hashable,
9-
is_int64_dtype, is_integer, is_integer_dtype, is_interval,
10-
is_interval_dtype, is_iterator, is_list_like, is_named_tuple, is_number,
11-
is_numeric_dtype, is_object_dtype, is_period, is_period_dtype, is_re,
12-
is_re_compilable, is_scalar, is_signed_integer_dtype, is_sparse,
8+
is_extension_array_dtype, is_extension_type, is_file_like, is_float,
9+
is_float_dtype, is_hashable, is_int64_dtype, is_integer, is_integer_dtype,
10+
is_interval, is_interval_dtype, is_iterator, is_list_like, is_named_tuple,
11+
is_number, is_numeric_dtype, is_object_dtype, is_period, is_period_dtype,
12+
is_re, is_re_compilable, is_scalar, is_signed_integer_dtype, is_sparse,
1313
is_string_dtype, is_timedelta64_dtype, is_timedelta64_ns_dtype,
1414
is_unsigned_integer_dtype, pandas_dtype)

pandas/core/dtypes/common.py

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1700,15 +1700,21 @@ def is_extension_type(arr):
17001700

17011701

17021702
def is_extension_array_dtype(arr_or_dtype):
1703-
"""Check if an object is a pandas extension array type.
1703+
"""
1704+
Check if an object is a pandas extension array type.
1705+
1706+
See the :ref:`Use Guide <extending.extension-types>` for more.
17041707
17051708
Parameters
17061709
----------
17071710
arr_or_dtype : object
1711+
For array-like input, the ``.dtype`` attribute will
1712+
be extracted.
17081713
17091714
Returns
17101715
-------
17111716
bool
1717+
Whether the `arr_or_dtype` is an extension array type.
17121718
17131719
Notes
17141720
-----
@@ -1718,9 +1724,25 @@ def is_extension_array_dtype(arr_or_dtype):
17181724
* Categorical
17191725
* Sparse
17201726
* Interval
1727+
* Period
1728+
* DatetimeArray
1729+
* TimedeltaArray
17211730
17221731
Third-party libraries may implement arrays or types satisfying
17231732
this interface as well.
1733+
1734+
Examples
1735+
--------
1736+
>>> from pandas.api.types import is_extension_array_dtype
1737+
>>> arr = pd.Categorical(['a', 'b'])
1738+
>>> is_extension_array_dtype(arr)
1739+
True
1740+
>>> is_extension_array_dtype(arr.dtype)
1741+
True
1742+
1743+
>>> arr = np.array(['a', 'b'])
1744+
>>> is_extension_array_dtype(arr.dtype)
1745+
False
17241746
"""
17251747
dtype = getattr(arr_or_dtype, 'dtype', arr_or_dtype)
17261748
return (isinstance(dtype, ExtensionDtype) or

pandas/core/indexing.py

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1405,17 +1405,16 @@ class _IXIndexer(_NDFrameIndexer):
14051405
See more at :ref:`Advanced Indexing <advanced>`.
14061406
"""
14071407

1408-
def __init__(self, name, obj):
1409-
1410-
_ix_deprecation_warning = textwrap.dedent("""
1411-
.ix is deprecated. Please use
1412-
.loc for label based indexing or
1413-
.iloc for positional indexing
1408+
_ix_deprecation_warning = textwrap.dedent("""
1409+
.ix is deprecated. Please use
1410+
.loc for label based indexing or
1411+
.iloc for positional indexing
14141412
1415-
See the documentation here:
1416-
http://pandas.pydata.org/pandas-docs/stable/indexing.html#ix-indexer-is-deprecated""") # noqa
1413+
See the documentation here:
1414+
http://pandas.pydata.org/pandas-docs/stable/indexing.html#ix-indexer-is-deprecated""") # noqa
14171415

1418-
warnings.warn(_ix_deprecation_warning,
1416+
def __init__(self, name, obj):
1417+
warnings.warn(self._ix_deprecation_warning,
14191418
DeprecationWarning, stacklevel=2)
14201419
super(_IXIndexer, self).__init__(name, obj)
14211420

pandas/tests/api/test_types.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,8 @@ class TestTypes(Base):
2424
'is_dict_like', 'is_iterator', 'is_file_like',
2525
'is_list_like', 'is_hashable', 'is_array_like',
2626
'is_named_tuple',
27-
'pandas_dtype', 'union_categoricals', 'infer_dtype']
27+
'pandas_dtype', 'union_categoricals', 'infer_dtype',
28+
'is_extension_array_dtype']
2829
deprecated = ['is_period', 'is_datetimetz']
2930
dtypes = ['CategoricalDtype', 'DatetimeTZDtype',
3031
'PeriodDtype', 'IntervalDtype']

0 commit comments

Comments
 (0)