Skip to content

BUG: Series.getitem not falling back to positional for bool index #48662

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 30 commits into from
Sep 26, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
8ad4ce9
BUG: Series.getitem not falling back to positional for bool index
phofl Sep 20, 2022
186a3d0
Update pandas/tests/series/indexing/test_getitem.py
phofl Sep 21, 2022
b3e977f
Fix build warning for use of `strdup` in ultrajson (#48369)
rgommers Sep 20, 2022
22a52c6
WEB: Update versions json to fix version switcher in the docs (#48655)
datapythonista Sep 20, 2022
4d07469
PERF: join/merge on subset of MultiIndex (#48611)
lukemanley Sep 20, 2022
c8ca83a
DOC: Update documentation for date_range(), bdate_range(), and interv…
gandhis1 Sep 20, 2022
dce4c73
TYP: tighten Axis (#48612)
twoertwein Sep 20, 2022
aa0fa52
BUG: Fix metadata propagation in df.corr and df.cov, GH28283 (#48616)
yuanx749 Sep 20, 2022
6c8390e
TST: add test case for PeriodIndex in HDFStore(GH7796) (#48618)
paradox-lab Sep 20, 2022
f38383f
Add OpenSSF Scorecards GitHub Action (#48570)
pnacht Sep 20, 2022
b9ec72b
ENH: move an exception and add a prehook to check for exception place…
dataxerik Sep 20, 2022
1294474
REGR: TextIOWrapper raising an error in read_csv (#48651)
twoertwein Sep 20, 2022
89a433e
Fix scorecard.yml workflow (#48668)
pnacht Sep 20, 2022
70f5f89
BUG: DatetimeIndex ignoring explicit tz=None (#48659)
jbrockmendel Sep 21, 2022
84f7ddb
Corrected pd.merge indicator type hint (#48677)
PabloRuizCuevas Sep 21, 2022
6a36027
DOC: Document default value for options.display.max_cols when not run…
tmoschou Sep 21, 2022
2e4bf41
ENH: DTA/TDA add datetimelike scalar with mismatched reso (#48669)
jbrockmendel Sep 21, 2022
c3571e6
REF: support reso in remaining tslibs helpers (#48661)
jbrockmendel Sep 21, 2022
48dab82
PERF: Avoid fragmentation of DataFrame in read_sas (#48603)
phofl Sep 21, 2022
4396e8c
DOC: Add deprecation infos to deprecated functions (#48599)
phofl Sep 21, 2022
0821c9c
BLD: Build wheels using cibuildwheel (#48283)
lithomas1 Sep 21, 2022
c6b0f0f
REGR: Performance decrease in factorize (#48620)
rhshadrach Sep 22, 2022
359cc5c
TYP: type all arguments with str default values (#48508)
twoertwein Sep 22, 2022
34e2b21
TST: Catch more pyarrow PerformanceWarnings (#48699)
mroeschke Sep 22, 2022
0a9f5ac
REGR: to_hdf raising AssertionError with boolean index (#48696)
phofl Sep 22, 2022
a746068
REGR: Regression in DataFrame.loc when setting df with all True index…
phofl Sep 22, 2022
7123154
BUG: pivot_table raising for nullable dtype and margins (#48714)
phofl Sep 22, 2022
e30a3d8
TST: Address MPL 3.6 deprecation warnings (#48695)
mroeschke Sep 22, 2022
f8c7df6
Merge remote-tracking branch 'upstream/main' into 48653
phofl Sep 22, 2022
2729963
Merge remote-tracking branch 'upstream/main' into 48653
phofl Sep 23, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
TST: Address MPL 3.6 deprecation warnings (#48695)
* TST: Address MPL 3.6 deprecation warnings

* Address min build

* missing ()
  • Loading branch information
mroeschke authored and phofl committed Sep 22, 2022
commit e30a3d8419c7a2488ce8f05cfa1747c51478f3d5
14 changes: 12 additions & 2 deletions pandas/io/formats/style.py
Original file line number Diff line number Diff line change
Expand Up @@ -3934,7 +3934,15 @@ def _background_gradient(
rng = smax - smin
# extend lower / upper bounds, compresses color range
norm = mpl.colors.Normalize(smin - (rng * low), smax + (rng * high))
rgbas = plt.cm.get_cmap(cmap)(norm(gmap))
from pandas.plotting._matplotlib.compat import mpl_ge_3_6_0

if mpl_ge_3_6_0():
if cmap is None:
rgbas = mpl.colormaps[mpl.rcParams["image.cmap"]](norm(gmap))
else:
rgbas = mpl.colormaps[cmap](norm(gmap))
else:
rgbas = plt.cm.get_cmap(cmap)(norm(gmap))

def relative_luminance(rgba) -> float:
"""
Expand Down Expand Up @@ -4213,8 +4221,10 @@ def css_calc(x, left: float, right: float, align: str, color: str | list | tuple
if cmap is not None:
# use the matplotlib colormap input
with _mpl(Styler.bar) as (plt, mpl):
from pandas.plotting._matplotlib.compat import mpl_ge_3_6_0

cmap = (
mpl.cm.get_cmap(cmap)
(mpl.colormaps[cmap] if mpl_ge_3_6_0() else mpl.cm.get_cmap(cmap))
if isinstance(cmap, str)
else cmap # assumed to be a Colormap instance as documented
)
Expand Down
6 changes: 5 additions & 1 deletion pandas/tests/io/formats/style/test_matplotlib.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import matplotlib as mpl

from pandas.io.formats.style import Styler
from pandas.plotting._matplotlib.compat import mpl_ge_3_6_0


@pytest.fixture
Expand Down Expand Up @@ -260,7 +261,10 @@ def test_background_gradient_gmap_wrong_series(styler_blank):
styler_blank.background_gradient(gmap=gmap, axis=None)._compute()


@pytest.mark.parametrize("cmap", ["PuBu", mpl.cm.get_cmap("PuBu")])
@pytest.mark.parametrize(
"cmap",
["PuBu", mpl.colormaps["PuBu"] if mpl_ge_3_6_0() else mpl.cm.get_cmap("PuBu")],
)
def test_bar_colormap(cmap):
data = DataFrame([[1, 2], [3, 4]])
ctx = data.style.bar(cmap=cmap, axis=None)._compute().ctx
Expand Down
4 changes: 4 additions & 0 deletions pandas/tests/plotting/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -479,25 +479,29 @@ def is_grid_on():
mpl.rc("axes", grid=False)
obj.plot(kind=kind, **kws)
assert not is_grid_on()
self.plt.clf()

self.plt.subplot(1, 4 * len(kinds), spndx)
spndx += 1
mpl.rc("axes", grid=True)
obj.plot(kind=kind, grid=False, **kws)
assert not is_grid_on()
self.plt.clf()

if kind not in ["pie", "hexbin", "scatter"]:
self.plt.subplot(1, 4 * len(kinds), spndx)
spndx += 1
mpl.rc("axes", grid=True)
obj.plot(kind=kind, **kws)
assert is_grid_on()
self.plt.clf()

self.plt.subplot(1, 4 * len(kinds), spndx)
spndx += 1
mpl.rc("axes", grid=False)
obj.plot(kind=kind, grid=True, **kws)
assert is_grid_on()
self.plt.clf()

def _unpack_cycler(self, rcParams, field="color"):
"""
Expand Down