Skip to content

Commit 8df5034

Browse files
author
Marco Gorelli
committed
Merge remote-tracking branch 'upstream/master' into inconsistent-namespace-ast
2 parents c69a748 + 373d677 commit 8df5034

File tree

14 files changed

+76
-28
lines changed

14 files changed

+76
-28
lines changed

doc/source/whatsnew/index.rst

+1
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ Version 1.2
2424
.. toctree::
2525
:maxdepth: 2
2626

27+
v1.2.3
2728
v1.2.2
2829
v1.2.1
2930
v1.2.0

doc/source/whatsnew/v1.2.2.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -46,4 +46,4 @@ Bug fixes
4646
Contributors
4747
~~~~~~~~~~~~
4848

49-
.. contributors:: v1.2.1..v1.2.2|HEAD
49+
.. contributors:: v1.2.1..v1.2.2

doc/source/whatsnew/v1.2.3.rst

+48
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
.. _whatsnew_123:
2+
3+
What's new in 1.2.3 (March ??, 2021)
4+
------------------------------------
5+
6+
These are the changes in pandas 1.2.3. See :ref:`release` for a full changelog
7+
including other versions of pandas.
8+
9+
{{ header }}
10+
11+
.. ---------------------------------------------------------------------------
12+
13+
.. _whatsnew_123.regressions:
14+
15+
Fixed regressions
16+
~~~~~~~~~~~~~~~~~
17+
18+
-
19+
-
20+
21+
.. ---------------------------------------------------------------------------
22+
23+
.. _whatsnew_123.bug_fixes:
24+
25+
Bug fixes
26+
~~~~~~~~~
27+
28+
-
29+
-
30+
31+
.. ---------------------------------------------------------------------------
32+
33+
.. _whatsnew_123.other:
34+
35+
Other
36+
~~~~~
37+
38+
-
39+
-
40+
41+
.. ---------------------------------------------------------------------------
42+
43+
.. _whatsnew_123.contributors:
44+
45+
Contributors
46+
~~~~~~~~~~~~
47+
48+
.. contributors:: v1.2.2..v1.2.3|HEAD

environment.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -114,4 +114,4 @@ dependencies:
114114
- natsort # DataFrame.sort_values
115115
- pip:
116116
- git+https://github.com/pandas-dev/pydata-sphinx-theme.git@2488b7defbd3d753dd5fcfc890fc4a7e79d25103
117-
- git+https://github.com/numpy/numpydoc
117+
- numpydoc < 1.2 # 2021-02-09 1.2dev breaking CI

pandas/core/arrays/categorical.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@
5454
)
5555
from pandas.core.dtypes.dtypes import CategoricalDtype
5656
from pandas.core.dtypes.generic import ABCIndex, ABCSeries
57-
from pandas.core.dtypes.missing import is_valid_nat_for_dtype, isna, notna
57+
from pandas.core.dtypes.missing import is_valid_na_for_dtype, isna, notna
5858

5959
from pandas.core import ops
6060
from pandas.core.accessor import PandasDelegate, delegate_names
@@ -1284,7 +1284,7 @@ def _validate_fill_value(self, fill_value):
12841284
TypeError
12851285
"""
12861286

1287-
if is_valid_nat_for_dtype(fill_value, self.categories.dtype):
1287+
if is_valid_na_for_dtype(fill_value, self.categories.dtype):
12881288
fill_value = -1
12891289
elif fill_value in self.categories:
12901290
fill_value = self._unbox_scalar(fill_value)
@@ -1779,7 +1779,7 @@ def __contains__(self, key) -> bool:
17791779
Returns True if `key` is in this Categorical.
17801780
"""
17811781
# if key is a NaN, check if any NaN is in self.
1782-
if is_valid_nat_for_dtype(key, self.categories.dtype):
1782+
if is_valid_na_for_dtype(key, self.categories.dtype):
17831783
return self.isna().any()
17841784

17851785
return contains(self, key, container=self._codes)

pandas/core/arrays/datetimelike.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@
5757
is_unsigned_integer_dtype,
5858
pandas_dtype,
5959
)
60-
from pandas.core.dtypes.missing import is_valid_nat_for_dtype, isna
60+
from pandas.core.dtypes.missing import is_valid_na_for_dtype, isna
6161

6262
from pandas.core import nanops, ops
6363
from pandas.core.algorithms import checked_add_with_arr, isin, unique1d
@@ -493,7 +493,7 @@ def _validate_fill_value(self, fill_value):
493493

494494
def _validate_shift_value(self, fill_value):
495495
# TODO(2.0): once this deprecation is enforced, use _validate_fill_value
496-
if is_valid_nat_for_dtype(fill_value, self.dtype):
496+
if is_valid_na_for_dtype(fill_value, self.dtype):
497497
fill_value = NaT
498498
elif isinstance(fill_value, self._recognized_scalars):
499499
# pandas\core\arrays\datetimelike.py:746: error: Too many arguments
@@ -557,7 +557,7 @@ def _validate_scalar(
557557
msg = self._validation_error_message(value, allow_listlike)
558558
raise TypeError(msg) from err
559559

560-
elif is_valid_nat_for_dtype(value, self.dtype):
560+
elif is_valid_na_for_dtype(value, self.dtype):
561561
# GH#18295
562562
value = NaT
563563

pandas/core/arrays/interval.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@
4343
ABCPeriodIndex,
4444
ABCSeries,
4545
)
46-
from pandas.core.dtypes.missing import is_valid_nat_for_dtype, isna, notna
46+
from pandas.core.dtypes.missing import is_valid_na_for_dtype, isna, notna
4747

4848
from pandas.core.algorithms import isin, take, value_counts
4949
from pandas.core.arrays.base import ExtensionArray, _extension_array_shared_docs
@@ -979,7 +979,7 @@ def _validate_scalar(self, value):
979979
if isinstance(value, Interval):
980980
self._check_closed_matches(value, name="value")
981981
left, right = value.left, value.right
982-
elif is_valid_nat_for_dtype(value, self.left.dtype):
982+
elif is_valid_na_for_dtype(value, self.left.dtype):
983983
# GH#18295
984984
left = right = value
985985
else:
@@ -994,7 +994,7 @@ def _validate_fill_value(self, value):
994994
def _validate_setitem_value(self, value):
995995
needs_float_conversion = False
996996

997-
if is_valid_nat_for_dtype(value, self.left.dtype):
997+
if is_valid_na_for_dtype(value, self.left.dtype):
998998
# na value: need special casing to set directly on numpy arrays
999999
if is_integer_dtype(self.dtype.subtype):
10001000
# can't set NaN on a numpy integer array

pandas/core/dtypes/cast.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@
8787
ABCSeries,
8888
)
8989
from pandas.core.dtypes.inference import is_list_like
90-
from pandas.core.dtypes.missing import is_valid_nat_for_dtype, isna, notna
90+
from pandas.core.dtypes.missing import is_valid_na_for_dtype, isna, notna
9191

9292
if TYPE_CHECKING:
9393
from pandas import Series
@@ -159,7 +159,7 @@ def maybe_unbox_datetimelike(value: Scalar, dtype: DtypeObj) -> Scalar:
159159
-----
160160
Caller is responsible for checking dtype.kind in ["m", "M"]
161161
"""
162-
if is_valid_nat_for_dtype(value, dtype):
162+
if is_valid_na_for_dtype(value, dtype):
163163
# GH#36541: can't fill array directly with pd.NaT
164164
# > np.empty(10, dtype="datetime64[64]").fill(pd.NaT)
165165
# ValueError: cannot convert float NaN to integer
@@ -535,7 +535,7 @@ def maybe_promote(dtype, fill_value=np.nan):
535535
dtype = np.dtype(np.object_)
536536
elif is_integer(fill_value) or (is_float(fill_value) and not isna(fill_value)):
537537
dtype = np.dtype(np.object_)
538-
elif is_valid_nat_for_dtype(fill_value, dtype):
538+
elif is_valid_na_for_dtype(fill_value, dtype):
539539
# e.g. pd.NA, which is not accepted by Timestamp constructor
540540
fill_value = np.datetime64("NaT", "ns")
541541
else:
@@ -551,7 +551,7 @@ def maybe_promote(dtype, fill_value=np.nan):
551551
):
552552
# TODO: What about str that can be a timedelta?
553553
dtype = np.dtype(np.object_)
554-
elif is_valid_nat_for_dtype(fill_value, dtype):
554+
elif is_valid_na_for_dtype(fill_value, dtype):
555555
# e.g pd.NA, which is not accepted by the Timedelta constructor
556556
fill_value = np.timedelta64("NaT", "ns")
557557
else:

pandas/core/dtypes/missing.py

+2-4
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@
2929
is_string_dtype,
3030
is_string_like_dtype,
3131
needs_i8_conversion,
32-
pandas_dtype,
3332
)
3433
from pandas.core.dtypes.generic import (
3534
ABCDataFrame,
@@ -535,7 +534,7 @@ def maybe_fill(arr, fill_value=np.nan):
535534
return arr
536535

537536

538-
def na_value_for_dtype(dtype, compat: bool = True):
537+
def na_value_for_dtype(dtype: DtypeObj, compat: bool = True):
539538
"""
540539
Return a dtype compat na value
541540
@@ -561,7 +560,6 @@ def na_value_for_dtype(dtype, compat: bool = True):
561560
>>> na_value_for_dtype(np.dtype('datetime64[ns]'))
562561
numpy.datetime64('NaT')
563562
"""
564-
dtype = pandas_dtype(dtype)
565563

566564
if is_extension_array_dtype(dtype):
567565
return dtype.na_value
@@ -590,7 +588,7 @@ def remove_na_arraylike(arr):
590588
return arr[notna(np.asarray(arr))]
591589

592590

593-
def is_valid_nat_for_dtype(obj, dtype: DtypeObj) -> bool:
591+
def is_valid_na_for_dtype(obj, dtype: DtypeObj) -> bool:
594592
"""
595593
isna check that excludes incompatible dtypes
596594

pandas/core/indexes/base.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@
8888
ABCTimedeltaIndex,
8989
)
9090
from pandas.core.dtypes.inference import is_dict_like
91-
from pandas.core.dtypes.missing import array_equivalent, is_valid_nat_for_dtype, isna
91+
from pandas.core.dtypes.missing import array_equivalent, is_valid_na_for_dtype, isna
9292

9393
from pandas.core import missing, ops
9494
from pandas.core.accessor import CachedAccessor
@@ -5216,7 +5216,7 @@ def _find_common_type_compat(self, target) -> DtypeObj:
52165216
Implementation of find_common_type that adjusts for Index-specific
52175217
special cases.
52185218
"""
5219-
if is_interval_dtype(self.dtype) and is_valid_nat_for_dtype(target, self.dtype):
5219+
if is_interval_dtype(self.dtype) and is_valid_na_for_dtype(target, self.dtype):
52205220
# e.g. setting NA value into IntervalArray[int64]
52215221
self = cast("IntervalIndex", self)
52225222
return IntervalDtype(np.float64, closed=self.closed)
@@ -5770,7 +5770,7 @@ def insert(self, loc: int, item):
57705770
# Note: this method is overridden by all ExtensionIndex subclasses,
57715771
# so self is never backed by an EA.
57725772
item = lib.item_from_zerodim(item)
5773-
if is_valid_nat_for_dtype(item, self.dtype) and self.dtype != object:
5773+
if is_valid_na_for_dtype(item, self.dtype) and self.dtype != object:
57745774
item = self._na_value
57755775

57765776
try:

pandas/core/indexes/category.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
is_categorical_dtype,
1616
is_scalar,
1717
)
18-
from pandas.core.dtypes.missing import is_valid_nat_for_dtype, isna, notna
18+
from pandas.core.dtypes.missing import is_valid_na_for_dtype, isna, notna
1919

2020
from pandas.core import accessor
2121
from pandas.core.arrays.categorical import Categorical, contains
@@ -348,7 +348,7 @@ def inferred_type(self) -> str:
348348
@doc(Index.__contains__)
349349
def __contains__(self, key: Any) -> bool:
350350
# if key is a NaN, check if any NaN is in self.
351-
if is_valid_nat_for_dtype(key, self.categories.dtype):
351+
if is_valid_na_for_dtype(key, self.categories.dtype):
352352
return self.hasnans
353353

354354
return contains(self, key, container=self._engine)

pandas/core/indexes/datetimes.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
is_datetime64tz_dtype,
2727
is_scalar,
2828
)
29-
from pandas.core.dtypes.missing import is_valid_nat_for_dtype
29+
from pandas.core.dtypes.missing import is_valid_na_for_dtype
3030

3131
from pandas.core.arrays.datetimes import DatetimeArray, tz_to_dtype
3232
import pandas.core.common as com
@@ -636,7 +636,7 @@ def get_loc(self, key, method=None, tolerance=None):
636636
raise InvalidIndexError(key)
637637

638638
orig_key = key
639-
if is_valid_nat_for_dtype(key, self.dtype):
639+
if is_valid_na_for_dtype(key, self.dtype):
640640
key = NaT
641641

642642
if isinstance(key, self._data._recognized_scalars):

pandas/core/series.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@
6060
is_list_like,
6161
is_object_dtype,
6262
is_scalar,
63+
pandas_dtype,
6364
validate_all_hashable,
6465
)
6566
from pandas.core.dtypes.generic import ABCDataFrame
@@ -405,7 +406,7 @@ def _init_dict(self, data, index=None, dtype: Optional[Dtype] = None):
405406
elif index is not None:
406407
# fastpath for Series(data=None). Just use broadcasting a scalar
407408
# instead of reindexing.
408-
values = na_value_for_dtype(dtype)
409+
values = na_value_for_dtype(pandas_dtype(dtype))
409410
keys = index
410411
else:
411412
keys, values = (), []

requirements-dev.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -77,4 +77,4 @@ pyreadstat
7777
tabulate>=0.8.3
7878
natsort
7979
git+https://github.com/pandas-dev/pydata-sphinx-theme.git@2488b7defbd3d753dd5fcfc890fc4a7e79d25103
80-
git+https://github.com/numpy/numpydoc
80+
numpydoc < 1.2

0 commit comments

Comments
 (0)