Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

FIX: pandas indexing error#5556

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
WeatherGod merged 10 commits intomatplotlib:v1.5.xfromtacaswell:fix_pandas_indexing
Dec 30, 2015
Merged
Show file tree
Hide file tree
Changes from1 commit
Commits
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
PrevPrevious commit
MNT: raise exception if generators passed in
 - moved next(iter(obj)) logic into a cbook function
  • Loading branch information
@tacaswell
tacaswell committedDec 29, 2015
commitbdaaf594a64744ffa088c586c7898a1b3bcc99aa
7 changes: 4 additions & 3 deletionslib/matplotlib/axes/_axes.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -2331,11 +2331,11 @@ def broken_barh(self, xranges, yrange, **kwargs):
"""
# process the unit information
if len(xranges):
xdata =next(iter(xranges))
xdata =cbook.safe_first_element(xranges)
else:
xdata = None
if len(yrange):
ydata =next(iter(yrange))
ydata =cbook.safe_first_element(yrange)
else:
ydata = None
self._process_unit_info(xdata=xdata,
Expand DownExpand Up@@ -5886,7 +5886,8 @@ def _normalize_input(inp, ename='input'):
Name to use in ValueError if `inp` can not be normalized

"""
if isinstance(x, np.ndarray) or not iterable(next(iter(inp))):
if (isinstance(x, np.ndarray) or
not iterable(cbook.safe_first_element(inp))):
# TODO: support masked arrays;
inp = np.asarray(inp)
if inp.ndim == 2:
Expand Down
8 changes: 8 additions & 0 deletionslib/matplotlib/cbook.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -12,6 +12,7 @@
from matplotlib.externals import six
from matplotlib.externals.six.moves import xrange, zip
from itertools import repeat
import collections

import datetime
import errno
Expand DownExpand Up@@ -2536,6 +2537,13 @@ def index_of(y):
return np.arange(y.shape[0], dtype=float), y


def safe_first_element(obj):
if isinstance(obj, collections.Iterator):
raise RuntimeError("matplotlib does not support generators "
"as input")
return next(iter(obj))


def get_label(y, default_name):
try:
return y.name
Expand Down
2 changes: 1 addition & 1 deletionlib/matplotlib/dates.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -1561,7 +1561,7 @@ def default_units(x, axis):
x = x.ravel()

try:
x =next(iter(x))
x =cbook.safe_first_element(x)
except (TypeError, StopIteration):
pass

Expand Down

[8]ページ先頭

©2009-2025 Movatter.jp