作者大大,你用的系统是啥?帮看下需改哪里,拜托!
我在聚宽云端试运行,应该是python2.7吧。提示:
File "/tmp/strategy/user_code.py", line 235, in
fund_data = get_fundamental_data(factor_list,ttm_factors,date,all_stocks)
File "/tmp/strategy/user_code.py", line 231, in get_fundamental_data
results = results.sort_values(by='code')
File "pandas/core/generic.py", line 2150, in __getattr__
(type(self).__name__, name))
AttributeError: 'DataFrame' object has no attribute 'sort_values'
估计你运行的是3.0,因此将sort_value改为sort_index后该处编译通过,但又出现了大堆其它错误:
File "/tmp/strategy/user_code.py", line 588, in
cut_factor_plot(fillna_data['EPS'],demean)
File "/tmp/strategy/user_code.py", line 584, in cut_factor_plot
df.plot(figsize=(20,10))
File "pandas/tools/plotting.py", line 2490, in plot_frame
**kwds)
File "pandas/tools/plotting.py", line 2326, in _plot
plot_obj.generate()
File "pandas/tools/plotting.py", line 913, in generate
self._setup_subplots()
File "pandas/tools/plotting.py", line 962, in _setup_subplots
fig = self.plt.figure(figsize=self.figsize)
File "matplotlib/pyplot.py", line 535, in figure
**kwargs)
File "matplotlib/backends/backend_tkagg.py", line 81, in new_figure_manager
return new_figure_manager_given_figure(num, figure)
File "matplotlib/backends/backend_tkagg.py", line 89, in new_figure_manager_given_figure
window = Tk.Tk()
File "lib-tk/Tkinter.py", line 1814, in __init__
self.tk = _tkinter.create(screenName, baseName, className, interactive, wantobjects, useTk, sync, use)
TclError: no display name and no $DISPLAY environment variable