jqfactor_analyzer icon indicating copy to clipboard operation
jqfactor_analyzer copied to clipboard

far.create_full_tear_sheet 报错

Open CattleHome opened this issue 3 years ago • 0 comments

TypeError Traceback (most recent call last) in 11 far.create_full_tear_sheet( 12 demeaned=False, group_adjust=False, by_group=False, ---> 13 turnover_periods=None, avgretplot=(5, 2), std_bar=False 14 )

D:\Anoconda\app\Lib\site-packages\jqfactor_analyzer\analyze.py in create_full_tear_sheet(self, demeaned, group_adjust, by_group, turnover_periods, avgretplot, std_bar) 1461 self.plot_quantile_returns_bar(by_group=False, 1462 demeaned=demeaned, -> 1463 group_adjust=group_adjust) 1464 pl.plt.show() 1465 self.plot_cumulative_returns(period=None, demeaned=demeaned, group_adjust=group_adjust)

D:\Anoconda\app\Lib\site-packages\jqfactor_analyzer\analyze.py in plot_quantile_returns_bar(self, by_group, demeaned, group_adjust) 1038 1039 pl.plot_quantile_returns_bar( -> 1040 mean_return_by_quantile, by_group=by_group, ylim_percentiles=None 1041 ) 1042

D:\Anoconda\app\Lib\site-packages\jqfactor_analyzer\plot_utils.py in call_w_context(*args, **kwargs) 23 with plotting_context(), axes_style(): 24 sns.despine(left=True) ---> 25 return func(*args, **kwargs) 26 else: 27 return func(*args, **kwargs)

D:\Anoconda\app\Lib\site-packages\jqfactor_analyzer\plotting.py in plot_quantile_returns_bar(mean_ret_by_q, by_group, ylim_percentiles, ax) 286 287 mean_ret_by_q.multiply(DECIMAL_TO_BPS).plot( --> 288 kind='bar', title=QRETURNBAR.get("TITLE"), ax=ax 289 ) 290 ax.set(xlabel="", ylabel=QRETURNBAR.get("YLABEL"), ylim=(ymin, ymax))

D:\Anoconda\app\Lib\site-packages\pandas\plotting_core.py in call(self, *args, **kwargs) 792 data.columns = label_name 793 --> 794 return plot_backend.plot(data, kind=kind, **kwargs) 795 796 def line(self, x=None, y=None, **kwargs):

D:\Anoconda\app\Lib\site-packages\pandas\plotting_matplotlib_init_.py in plot(data, kind, **kwargs) 60 kwargs["ax"] = getattr(ax, "left_ax", ax) 61 plot_obj = PLOT_CLASSES[kind](data, **kwargs) ---> 62 plot_obj.generate() 63 plot_obj.draw() 64 return plot_obj.result

D:\Anoconda\app\Lib\site-packages\pandas\plotting_matplotlib\core.py in generate(self) 277 def generate(self): 278 self._args_adjust() --> 279 self._compute_plot_data() 280 self._setup_subplots() 281 self._make_plot()

D:\Anoconda\app\Lib\site-packages\pandas\plotting_matplotlib\core.py in _compute_plot_data(self) 402 data = data._convert(datetime=True, timedelta=True) 403 numeric_data = data.select_dtypes( --> 404 include=[np.number, "datetime", "datetimetz", "timedelta"] 405 ) 406

D:\Anoconda\app\Lib\site-packages\pandas\core\frame.py in select_dtypes(self, include, exclude) 3440 # the "union" of the logic of case 1 and case 2: 3441 # we get the included and excluded, and return their logical and -> 3442 include_these = Series(not bool(include), index=self.columns) 3443 exclude_these = Series(not bool(exclude), index=self.columns) 3444

D:\Anoconda\app\Lib\site-packages\pandas\core\series.py in init(self, data, index, dtype, name, copy, fastpath) 312 data = data.copy() 313 else: --> 314 data = sanitize_array(data, index, dtype, copy, raise_cast_failure=True) 315 316 data = SingleBlockManager(data, index, fastpath=True)

D:\Anoconda\app\Lib\site-packages\pandas\core\internals\construction.py in sanitize_array(data, index, dtype, copy, raise_cast_failure) 710 value = maybe_cast_to_datetime(value, dtype) 711 --> 712 subarr = construct_1d_arraylike_from_scalar(value, len(index), dtype) 713 714 else:

D:\Anoconda\app\Lib\site-packages\pandas\core\dtypes\cast.py in construct_1d_arraylike_from_scalar(value, length, dtype) 1231 value = ensure_str(value) 1232 -> 1233 subarr = np.empty(length, dtype=dtype) 1234 subarr.fill(value) 1235

TypeError: Cannot interpret '<attribute 'dtype' of 'numpy.generic' objects>' as a data type

CattleHome avatar Mar 26 '21 03:03 CattleHome