Skip to content

Commit e57c850

Browse files
Merge remote-tracking branch 'upstream/master' into arrow-string-array-dtype
2 parents 1d59c7a + ad58cf6 commit e57c850

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

72 files changed

+1154
-699
lines changed

asv_bench/benchmarks/frame_methods.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -652,7 +652,9 @@ class Rank:
652652
]
653653

654654
def setup(self, dtype):
655-
self.df = DataFrame(np.random.randn(10000, 10), columns=range(10), dtype=dtype)
655+
self.df = DataFrame(
656+
np.random.randn(10000, 10).astype(dtype), columns=range(10), dtype=dtype
657+
)
656658

657659
def time_rank(self, dtype):
658660
self.df.rank()

asv_bench/benchmarks/plotting.py

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
1+
import importlib
2+
import sys
3+
14
import matplotlib
25
import numpy as np
6+
import pkg_resources
37

48
from pandas import (
59
DataFrame,
@@ -13,6 +17,8 @@
1317
except ImportError:
1418
from pandas.tools.plotting import andrews_curves
1519

20+
from pandas.plotting._core import _get_plot_backend
21+
1622
matplotlib.use("Agg")
1723

1824

@@ -99,4 +105,28 @@ def time_plot_andrews_curves(self):
99105
andrews_curves(self.df, "Name")
100106

101107

108+
class BackendLoading:
109+
repeat = 1
110+
number = 1
111+
warmup_time = 0
112+
113+
def setup(self):
114+
dist = pkg_resources.get_distribution("pandas")
115+
spec = importlib.machinery.ModuleSpec("my_backend", None)
116+
mod = importlib.util.module_from_spec(spec)
117+
mod.plot = lambda *args, **kwargs: 1
118+
119+
backends = pkg_resources.get_entry_map("pandas")
120+
my_entrypoint = pkg_resources.EntryPoint(
121+
"pandas_plotting_backend", mod.__name__, dist=dist
122+
)
123+
backends["pandas_plotting_backends"][mod.__name__] = my_entrypoint
124+
for i in range(10):
125+
backends["pandas_plotting_backends"][str(i)] = my_entrypoint
126+
sys.modules["my_backend"] = mod
127+
128+
def time_get_plot_backend(self):
129+
_get_plot_backend("my_backend")
130+
131+
102132
from .pandas_vb_common import setup # noqa: F401 isort:skip

doc/source/reference/style.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,5 +67,6 @@ Style export and import
6767
Styler.render
6868
Styler.export
6969
Styler.use
70+
Styler.to_html
7071
Styler.to_excel
7172
Styler.to_latex

doc/source/user_guide/options.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -487,6 +487,8 @@ styler.sparse.index True "Sparsify" MultiIndex displ
487487
elements in outer levels within groups).
488488
styler.sparse.columns True "Sparsify" MultiIndex display for columns
489489
in Styler output.
490+
styler.render.max_elements 262144 Maximum number of datapoints that Styler will render
491+
trimming either rows, columns or both to fit.
490492
======================================= ============ ==================================
491493

492494

doc/source/whatsnew/v1.2.5.rst

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,13 @@ Fixed regressions
2121

2222
.. ---------------------------------------------------------------------------
2323
24+
.. _whatsnew_125.deprecations:
25+
26+
Deprecations
27+
~~~~~~~~~~~~
28+
29+
- Deprecated passing lists as ``key`` to :meth:`DataFrame.xs` and :meth:`Series.xs` (:issue:`41760`)
30+
2431
.. _whatsnew_125.bug_fixes:
2532

2633
Bug fixes

doc/source/whatsnew/v1.3.0.rst

Lines changed: 91 additions & 86 deletions
Large diffs are not rendered by default.

pandas/_libs/groupby.pyx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -516,7 +516,7 @@ def group_add(add_t[:, ::1] out,
516516
val = values[i, j]
517517

518518
# not nan
519-
if val == val:
519+
if not checknull(val):
520520
nobs[lab, j] += 1
521521

522522
if nobs[lab, j] == 1:

pandas/_libs/index.pyx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,8 @@ cdef class IndexEngine:
106106

107107
try:
108108
return self.mapping.get_item(val)
109-
except (TypeError, ValueError):
109+
except (TypeError, ValueError, OverflowError):
110+
# GH#41775 OverflowError e.g. if we are uint64 and val is -1
110111
raise KeyError(val)
111112

112113
cdef inline _get_loc_duplicates(self, object val):

pandas/_libs/lib.pyi

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,10 @@ from typing import (
1111

1212
import numpy as np
1313

14-
from pandas._typing import ArrayLike
14+
from pandas._typing import (
15+
ArrayLike,
16+
DtypeObj,
17+
)
1518

1619
# placeholder until we can specify np.ndarray[object, ndim=2]
1720
ndarray_obj_2d = np.ndarray
@@ -52,8 +55,6 @@ def is_float_array(values: np.ndarray, skipna: bool = False): ...
5255
def is_integer_array(values: np.ndarray, skipna: bool = False): ...
5356
def is_bool_array(values: np.ndarray, skipna: bool = False): ...
5457

55-
def fast_multiget(mapping: dict, keys: np.ndarray, default=np.nan) -> np.ndarray: ...
56-
5758
def fast_unique_multiple_list_gen(gen: Generator, sort: bool = True) -> list: ...
5859
def fast_unique_multiple_list(lists: list, sort: bool = True) -> list: ...
5960
def fast_unique_multiple(arrays: list, sort: bool = True) -> list: ...
@@ -73,6 +74,7 @@ def maybe_convert_objects(
7374
convert_timedelta: bool = ...,
7475
convert_period: Literal[False] = ...,
7576
convert_to_nullable_integer: Literal[False] = ...,
77+
dtype_if_all_nat: DtypeObj | None = ...,
7678
) -> np.ndarray: ...
7779

7880
@overload
@@ -85,6 +87,7 @@ def maybe_convert_objects(
8587
convert_timedelta: bool = ...,
8688
convert_period: bool = ...,
8789
convert_to_nullable_integer: Literal[True] = ...,
90+
dtype_if_all_nat: DtypeObj | None = ...,
8891
) -> ArrayLike: ...
8992

9093
@overload
@@ -97,6 +100,7 @@ def maybe_convert_objects(
97100
convert_timedelta: bool = ...,
98101
convert_period: bool = ...,
99102
convert_to_nullable_integer: bool = ...,
103+
dtype_if_all_nat: DtypeObj | None = ...,
100104
) -> ArrayLike: ...
101105

102106
@overload
@@ -109,6 +113,7 @@ def maybe_convert_objects(
109113
convert_timedelta: bool = ...,
110114
convert_period: Literal[True] = ...,
111115
convert_to_nullable_integer: bool = ...,
116+
dtype_if_all_nat: DtypeObj | None = ...,
112117
) -> ArrayLike: ...
113118

114119
@overload
@@ -121,6 +126,7 @@ def maybe_convert_objects(
121126
convert_timedelta: bool = ...,
122127
convert_period: bool = ...,
123128
convert_to_nullable_integer: bool = ...,
129+
dtype_if_all_nat: DtypeObj | None = ...,
124130
) -> ArrayLike: ...
125131

126132
@overload
@@ -184,11 +190,7 @@ def maybe_indices_to_slice(
184190
max_len: int,
185191
) -> slice | np.ndarray: ... # np.ndarray[np.uint8]
186192

187-
def clean_index_list(obj: list) -> tuple[
188-
list | np.ndarray, # np.ndarray[object] | np.ndarray[np.int64]
189-
bool,
190-
]: ...
191-
193+
def is_all_arraylike(obj: list) -> bool: ...
192194

193195
# -----------------------------------------------------------------
194196
# Functions which in reality take memoryviews

0 commit comments

Comments
 (0)