Skip to content

Commit 5039c92

Browse files
authored
Merge pull request #78 from pandas-dev/master
Sync Fork from Upstream Repo
2 parents 0091643 + c5f11ab commit 5039c92

File tree

23 files changed

+415
-357
lines changed

23 files changed

+415
-357
lines changed

doc/source/whatsnew/v1.1.0.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,7 @@ Numeric
234234
Conversion
235235
^^^^^^^^^^
236236
- Bug in :class:`Series` construction from NumPy array with big-endian ``datetime64`` dtype (:issue:`29684`)
237-
-
237+
- Bug in :class:`Timedelta` construction with large nanoseconds keyword value (:issue:`34202`)
238238
-
239239

240240
Strings
@@ -327,6 +327,7 @@ Reshaping
327327
- Bug in :func:`crosstab` when inputs are two Series and have tuple names, the output will keep dummy MultiIndex as columns. (:issue:`18321`)
328328
- :meth:`DataFrame.pivot` can now take lists for ``index`` and ``columns`` arguments (:issue:`21425`)
329329
- Bug in :func:`concat` where the resulting indices are not copied when ``copy=True`` (:issue:`29879`)
330+
- :meth:`Series.append` will now raise a ``TypeError`` when passed a DataFrame or a sequence containing Dataframe (:issue:`31413`)
330331
- :meth:`DataFrame.replace` and :meth:`Series.replace` will raise a ``TypeError`` if ``to_replace`` is not an expected type. Previously the ``replace`` would fail silently (:issue:`18634`)
331332

332333

@@ -349,7 +350,6 @@ Other
349350
instead of ``TypeError: Can only append a Series if ignore_index=True or if the Series has a name`` (:issue:`30871`)
350351
- Set operations on an object-dtype :class:`Index` now always return object-dtype results (:issue:`31401`)
351352
- Bug in :meth:`AbstractHolidayCalendar.holidays` when no rules were defined (:issue:`31415`)
352-
-
353353

354354
.. ---------------------------------------------------------------------------
355355

pandas/_libs/tslibs/timedeltas.pyx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1198,7 +1198,7 @@ class Timedelta(_Timedelta):
11981198

11991199
kwargs = {key: _to_py_int_float(kwargs[key]) for key in kwargs}
12001200

1201-
nano = np.timedelta64(kwargs.pop('nanoseconds', 0), 'ns')
1201+
nano = convert_to_timedelta64(kwargs.pop('nanoseconds', 0), 'ns')
12021202
try:
12031203
value = nano + convert_to_timedelta64(timedelta(**kwargs),
12041204
'ns')

pandas/_testing.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -706,11 +706,11 @@ def _get_ilevel_values(index, level):
706706
if isinstance(left, pd.PeriodIndex) or isinstance(right, pd.PeriodIndex):
707707
assert_attr_equal("freq", left, right, obj=obj)
708708
if isinstance(left, pd.IntervalIndex) or isinstance(right, pd.IntervalIndex):
709-
assert_interval_array_equal(left.values, right.values)
709+
assert_interval_array_equal(left._values, right._values)
710710

711711
if check_categorical:
712712
if is_categorical_dtype(left) or is_categorical_dtype(right):
713-
assert_categorical_equal(left.values, right.values, obj=f"{obj} category")
713+
assert_categorical_equal(left._values, right._values, obj=f"{obj} category")
714714

715715

716716
def assert_class_equal(left, right, exact: Union[bool, str] = True, obj="Input"):
@@ -883,7 +883,7 @@ def assert_interval_array_equal(left, right, exact="equiv", obj="IntervalArray")
883883
def assert_period_array_equal(left, right, obj="PeriodArray"):
884884
_check_isinstance(left, right, PeriodArray)
885885

886-
assert_numpy_array_equal(left._data, right._data, obj=f"{obj}.values")
886+
assert_numpy_array_equal(left._data, right._data, obj=f"{obj}._data")
887887
assert_attr_equal("freq", left, right, obj=obj)
888888

889889

@@ -1170,10 +1170,10 @@ def assert_series_equal(
11701170

11711171
# datetimelike may have different objects (e.g. datetime.datetime
11721172
# vs Timestamp) but will compare equal
1173-
if not Index(left.values).equals(Index(right.values)):
1173+
if not Index(left._values).equals(Index(right._values)):
11741174
msg = (
1175-
f"[datetimelike_compat=True] {left.values} "
1176-
f"is not equal to {right.values}."
1175+
f"[datetimelike_compat=True] {left._values} "
1176+
f"is not equal to {right._values}."
11771177
)
11781178
raise AssertionError(msg)
11791179
else:
@@ -1212,8 +1212,8 @@ def assert_series_equal(
12121212
if check_categorical:
12131213
if is_categorical_dtype(left) or is_categorical_dtype(right):
12141214
assert_categorical_equal(
1215-
left.values,
1216-
right.values,
1215+
left._values,
1216+
right._values,
12171217
obj=f"{obj} category",
12181218
check_category_order=check_category_order,
12191219
)

pandas/core/dtypes/cast.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1181,9 +1181,11 @@ def try_timedelta(v):
11811181
from pandas import to_timedelta
11821182

11831183
try:
1184-
return to_timedelta(v)._ndarray_values.reshape(shape)
1184+
td_values = to_timedelta(v)
11851185
except ValueError:
11861186
return v.reshape(shape)
1187+
else:
1188+
return np.asarray(td_values).reshape(shape)
11871189

11881190
inferred_type = lib.infer_datetimelike_array(ensure_object(v))
11891191

pandas/core/frame.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4580,7 +4580,7 @@ def drop_duplicates(
45804580
duplicated = self.duplicated(subset, keep=keep)
45814581

45824582
if inplace:
4583-
(inds,) = (-duplicated)._ndarray_values.nonzero()
4583+
(inds,) = np.asarray(-duplicated).nonzero()
45844584
new_data = self._data.take(inds)
45854585

45864586
if ignore_index:

0 commit comments

Comments
 (0)