amphibian-dev / toad

ESC Team's credit scorecard tools.
https://toad.readthedocs.io
MIT License
488 stars 175 forks source link

ValueError: cannot convert float NaN to integer #4

Closed yangyangtongxue closed 4 years ago

yangyangtongxue commented 4 years ago

当我执行分箱画图时报错,不知道怎么解决,烦请作者有时间看下 image

image

Secbone commented 4 years ago

@yangyangtongxue 有完整的报错信息么?

yangyangtongxue commented 4 years ago

ValueError Traceback (most recent call last) E:\Anaconda\lib\site-packages\IPython\core\formatters.py in call(self, obj) 339 pass 340 else: --> 341 return printer(obj) 342 # Finally look for special method names 343 method = get_real_method(obj, self.print_method)

E:\Anaconda\lib\site-packages\IPython\core\pylabtools.py in (fig) 242 243 if 'png' in formats: --> 244 png_formatter.for_type(Figure, lambda fig: print_figure(fig, 'png', kwargs)) 245 if 'retina' in formats or 'png2x' in formats: 246 png_formatter.for_type(Figure, lambda fig: retina_figure(fig, kwargs))

E:\Anaconda\lib\site-packages\IPython\core\pylabtools.py in print_figure(fig, fmt, bbox_inches, kwargs) 126 127 bytes_io = BytesIO() --> 128 fig.canvas.print_figure(bytes_io, kw) 129 data = bytes_io.getvalue() 130 if fmt == 'svg':

E:\Anaconda\lib\site-packages\matplotlib\backend_bases.py in print_figure(self, filename, dpi, facecolor, edgecolor, orientation, format, bbox_inches, kwargs) 2073 orientation=orientation, 2074 bbox_inches_restore=_bbox_inches_restore, -> 2075 kwargs) 2076 finally: 2077 if bbox_inches and restore_bbox:

E:\Anaconda\lib\site-packages\matplotlib\backends\backend_agg.py in print_png(self, filename_or_obj, *args, **kwargs) 508 509 """ --> 510 FigureCanvasAgg.draw(self) 511 renderer = self.get_renderer() 512

E:\Anaconda\lib\site-packages\matplotlib\backends\backend_agg.py in draw(self) 400 toolbar = self.toolbar 401 try: --> 402 self.figure.draw(self.renderer) 403 # A GUI class may be need to update a window using this draw, so 404 # don't forget to call the superclass.

E:\Anaconda\lib\site-packages\matplotlib\artist.py in draw_wrapper(artist, renderer, *args, *kwargs) 48 renderer.start_filter() 49 ---> 50 return draw(artist, renderer, args, **kwargs) 51 finally: 52 if artist.get_agg_filter() is not None:

E:\Anaconda\lib\site-packages\matplotlib\figure.py in draw(self, renderer) 1647 1648 mimage._draw_list_compositing_images( -> 1649 renderer, self, artists, self.suppressComposite) 1650 1651 renderer.close_group('figure')

E:\Anaconda\lib\site-packages\matplotlib\image.py in _draw_list_compositing_images(renderer, parent, artists, suppress_composite) 136 if not_composite or not has_images: 137 for a in artists: --> 138 a.draw(renderer) 139 else: 140 # Composite any adjacent images together

E:\Anaconda\lib\site-packages\matplotlib\artist.py in draw_wrapper(artist, renderer, *args, *kwargs) 48 renderer.start_filter() 49 ---> 50 return draw(artist, renderer, args, **kwargs) 51 finally: 52 if artist.get_agg_filter() is not None:

E:\Anaconda\lib\site-packages\matplotlib\axes_base.py in draw(self, renderer, inframe) 2626 renderer.stop_rasterizing() 2627 -> 2628 mimage._draw_list_compositing_images(renderer, self, artists) 2629 2630 renderer.close_group('axes')

E:\Anaconda\lib\site-packages\matplotlib\image.py in _draw_list_compositing_images(renderer, parent, artists, suppress_composite) 136 if not_composite or not has_images: 137 for a in artists: --> 138 a.draw(renderer) 139 else: 140 # Composite any adjacent images together

E:\Anaconda\lib\site-packages\matplotlib\artist.py in draw_wrapper(artist, renderer, *args, *kwargs) 48 renderer.start_filter() 49 ---> 50 return draw(artist, renderer, args, **kwargs) 51 finally: 52 if artist.get_agg_filter() is not None:

E:\Anaconda\lib\site-packages\matplotlib\axis.py in draw(self, renderer, *args, **kwargs) 1183 renderer.open_group(name) 1184 -> 1185 ticks_to_draw = self._update_ticks(renderer) 1186 ticklabelBoxes, ticklabelBoxes2 = self._get_tick_bboxes(ticks_to_draw, 1187 renderer)

E:\Anaconda\lib\site-packages\matplotlib\axis.py in _update_ticks(self, renderer) 1021 1022 interval = self.get_view_interval() -> 1023 tick_tups = list(self.iter_ticks()) # iter_ticks calls the locator 1024 if self._smart_bounds and tick_tups: 1025 # handle inverted limits

E:\Anaconda\lib\site-packages\matplotlib\axis.py in iter_ticks(self) 965 Iterate through all of the major and minor ticks. 966 """ --> 967 majorLocs = self.major.locator() 968 majorTicks = self.get_major_ticks(len(majorLocs)) 969 self.major.formatter.set_locs(majorLocs)

E:\Anaconda\lib\site-packages\matplotlib\ticker.py in call(self) 1983 def call(self): 1984 vmin, vmax = self.axis.get_view_interval() -> 1985 return self.tick_values(vmin, vmax) 1986 1987 def tick_values(self, vmin, vmax):

E:\Anaconda\lib\site-packages\matplotlib\ticker.py in tick_values(self, vmin, vmax) 1991 vmin, vmax = mtransforms.nonsingular( 1992 vmin, vmax, expander=1e-13, tiny=1e-14) -> 1993 locs = self._raw_ticks(vmin, vmax) 1994 1995 prune = self._prune

E:\Anaconda\lib\site-packages\matplotlib\ticker.py in _raw_ticks(self, vmin, vmax) 1930 if self._nbins == 'auto': 1931 if self.axis is not None: -> 1932 nbins = np.clip(self.axis.get_tick_space(), 1933 max(1, self._min_n_ticks - 1), 9) 1934 else:

E:\Anaconda\lib\site-packages\matplotlib\axis.py in get_tick_space(self) 2541 size = tick.label1.get_size() * 2.0 2542 if size > 0: -> 2543 return int(np.floor(length / size)) 2544 else: 2545 return 2**31 - 1

ValueError: cannot convert float NaN to integer

yangyangtongxue commented 4 years ago

@yangyangtongxue 有完整的报错信息么? 我把bin_plot改成badrate_plot就没有报错

Secbone commented 4 years ago

@yangyangtongxue 更新一下你的 matplotlib 再试一下,看样子不是 toad 的问题,像是显示的时候的问题.