Skip to content

Commit cb6140f

Browse files
committed
remove char in 1.5.2, merge in upstream
2 parents a4142ad + e3143f6 commit cb6140f

File tree

17 files changed

+297
-57
lines changed

17 files changed

+297
-57
lines changed

ci/deps/actions-38-downstream_compat.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ dependencies:
3434
- gcsfs
3535
- jinja2
3636
- lxml
37-
- matplotlib
37+
- matplotlib>=3.6.1
3838
- numba
3939
- numexpr
4040
- openpyxl

ci/deps/circle-38-arm64.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ dependencies:
3333
- gcsfs
3434
- jinja2
3535
- lxml
36-
- matplotlib
36+
- matplotlib>=3.6.1
3737
- numba
3838
- numexpr
3939
- openpyxl

doc/source/user_guide/basics.rst

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1213,12 +1213,6 @@ With a DataFrame, you can simultaneously reindex the index and columns:
12131213
df
12141214
df.reindex(index=["c", "f", "b"], columns=["three", "two", "one"])
12151215
1216-
You may also use ``reindex`` with an ``axis`` keyword:
1217-
1218-
.. ipython:: python
1219-
1220-
df.reindex(["c", "f", "b"], axis="index")
1221-
12221216
Note that the ``Index`` objects containing the actual axis labels can be
12231217
**shared** between objects. So if we have a Series and a DataFrame, the
12241218
following can be done:

doc/source/whatsnew/v1.5.2.rst

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ Bug fixes
2929
~~~~~~~~~
3030
- Bug in the Copy-on-Write implementation losing track of views in certain chained indexing cases (:issue:`48996`)
3131
- Fixed memory leak in :meth:`.Styler.to_excel` (:issue:`49751`)
32-
-
3332

3433
.. ---------------------------------------------------------------------------
3534
.. _whatsnew_152.other:

doc/source/whatsnew/v1.5.3.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ Fixed regressions
2727
Bug fixes
2828
~~~~~~~~~
2929
- Bug in :meth:`.Styler.to_excel` leading to error when unrecognized ``border-style`` (e.g. ``"hair"``) provided to Excel writers (:issue:`48649`)
30+
- Bug when chaining several :meth:`.Styler.concat` calls, only the last styler was concatenated (:issue:`49207`)
3031
- Fixed bug when instantiating a :class:`DataFrame` subclass inheriting from ``typing.Generic`` that triggered a ``UserWarning`` on python 3.11 (:issue:`49649`)
3132
-
3233

@@ -36,7 +37,6 @@ Bug fixes
3637
Other
3738
~~~~~
3839
-
39-
-
4040

4141
.. ---------------------------------------------------------------------------
4242
.. _whatsnew_153.contributors:

doc/source/whatsnew/v2.0.0.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -717,7 +717,7 @@ Timezones
717717
^^^^^^^^^
718718
- Bug in :meth:`Series.astype` and :meth:`DataFrame.astype` with object-dtype containing multiple timezone-aware ``datetime`` objects with heterogeneous timezones to a :class:`DatetimeTZDtype` incorrectly raising (:issue:`32581`)
719719
- Bug in :func:`to_datetime` was failing to parse date strings with timezone name when ``format`` was specified with ``%Z`` (:issue:`49748`)
720-
-
720+
- Better error message when passing invalid values to ``ambiguous`` parameter in :meth:`Timestamp.tz_localize` (:issue:`49565`)
721721

722722
Numeric
723723
^^^^^^^

environment.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ dependencies:
3535
- gcsfs
3636
- jinja2
3737
- lxml
38-
- matplotlib
38+
- matplotlib>=3.6.1
3939
- numba>=0.53.1
4040
- numexpr>=2.8.0 # pin for "Run checks on imported code" job
4141
- openpyxl

pandas/_libs/tslibs/timestamps.pyx

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ construction requirements, we need to do object instantiation in python
66
(see Timestamp class below). This will serve as a C extension type that
77
shadows the python class, where we do any heavy lifting.
88
"""
9-
import warnings
109

10+
import warnings
1111
cimport cython
1212

1313
import numpy as np
@@ -1944,8 +1944,11 @@ default 'raise'
19441944
>>> pd.NaT.tz_localize()
19451945
NaT
19461946
"""
1947-
if ambiguous == "infer":
1948-
raise ValueError("Cannot infer offset with only one time.")
1947+
if not isinstance(ambiguous, bool) and ambiguous not in {"NaT", "raise"}:
1948+
raise ValueError(
1949+
"'ambiguous' parameter must be one of: "
1950+
"True, False, 'NaT', 'raise' (default)"
1951+
)
19491952

19501953
nonexistent_options = ("raise", "NaT", "shift_forward", "shift_backward")
19511954
if nonexistent not in nonexistent_options and not PyDelta_Check(nonexistent):

pandas/core/indexes/interval.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,8 @@
5959
is_number,
6060
is_object_dtype,
6161
is_scalar,
62+
is_signed_integer_dtype,
63+
is_unsigned_integer_dtype,
6264
)
6365
from pandas.core.dtypes.dtypes import IntervalDtype
6466
from pandas.core.dtypes.missing import is_valid_na_for_dtype
@@ -521,6 +523,7 @@ def _maybe_convert_i8(self, key):
521523
original = key
522524
if is_list_like(key):
523525
key = ensure_index(key)
526+
key = self._maybe_convert_numeric_to_64bit(key)
524527

525528
if not self._needs_i8_conversion(key):
526529
return original
@@ -566,6 +569,20 @@ def _maybe_convert_i8(self, key):
566569

567570
return key_i8
568571

572+
def _maybe_convert_numeric_to_64bit(self, idx: Index) -> Index:
573+
# IntervalTree only supports 64 bit numpy array
574+
dtype = idx.dtype
575+
if np.issubclass_(dtype.type, np.number):
576+
return idx
577+
elif is_signed_integer_dtype(dtype) and dtype != np.int64:
578+
return idx.astype(np.int64)
579+
elif is_unsigned_integer_dtype(dtype) and dtype != np.uint64:
580+
return idx.astype(np.uint64)
581+
elif is_float_dtype(dtype) and dtype != np.float64:
582+
return idx.astype(np.float64)
583+
else:
584+
return idx
585+
569586
def _searchsorted_monotonic(self, label, side: Literal["left", "right"] = "left"):
570587
if not self.is_non_overlapping_monotonic:
571588
raise KeyError(

pandas/io/formats/style.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -316,6 +316,12 @@ def concat(self, other: Styler) -> Styler:
316316
inherited from the original Styler and not ``other``.
317317
- hidden columns and hidden index levels will be inherited from the
318318
original Styler
319+
- ``css`` will be inherited from the original Styler, and the value of
320+
keys ``data``, ``row_heading`` and ``row`` will be prepended with
321+
``foot0_``. If more concats are chained, their styles will be prepended
322+
with ``foot1_``, ''foot_2'', etc., and if a concatenated style have
323+
another concatanated style, the second style will be prepended with
324+
``foot{parent}_foot{child}_``.
319325
320326
A common use case is to concatenate user defined functions with
321327
``DataFrame.agg`` or with described statistics via ``DataFrame.describe``.
@@ -367,7 +373,7 @@ def concat(self, other: Styler) -> Styler:
367373
"number of index levels must be same in `other` "
368374
"as in `Styler`. See documentation for suggestions."
369375
)
370-
self.concatenated = other
376+
self.concatenated.append(other)
371377
return self
372378

373379
def _repr_html_(self) -> str | None:

0 commit comments

Comments
 (0)