首页上一页 1 下一页尾页 2 条记录 1/1页
第二章的源码下载后运行不了
发表在Python图书答疑
2022-02-04
《Python项目开发实战入门》第2章 销售收入分析与预测
是否精华
是
否
版块置顶:
是
否
也按书里下载了第三方模块运行后就一大堆红的 帮我看看、 D:\新建文件夹\02\JDData_month.py:27: FutureWarning: As the xlwt package is no longer maintained, the xlwt engine will be removed in a future version of pandas. This is the only engine in pandas that supports writing in the xls format. Install openpyxl and write to an xlsx file instead. You can set the option io.excel.xls.writer to 'xlwt' to silence this warning. While this option is deprecated and will also raise a warning, it can be globally set and the warning suppressed. dfData_month.to_excel(resultfile1) #导出结果 D:\新建文件夹\02\JDData_month.py:28: FutureWarning: As the xlwt package is no longer maintained, the xlwt engine will be removed in a future version of pandas. This is the only engine in pandas that supports writing in the xls format. Install openpyxl and write to an xlsx file instead. You can set the option io.excel.xls.writer to 'xlwt' to silence this warning. While this option is deprecated and will also raise a warning, it can be globally set and the warning suppressed. dfCar_month.to_excel(resultfile2) #导出结果 F:\新建文件夹 (6)\lib\site-packages\sklearn\linear_model\_base.py:148: FutureWarning: 'normalize' was deprecated in version 1.0 and will be removed in 1.2. Please leave the normalize parameter to its default value to silence this warning. The default behavior of this estimator is to not do any normalization. If normalization is needed please use sklearn.preprocessing.StandardScaler instead. 支出 投放日期 2018-01 13985.51 2018-02 6265.78 2018-03 12116.45 2018-04 15832.77 2018-05 18064.53 2018-06 57013.59 warnings.warn( 7月投放60000元广告费,预计销售收入 373828.90186837834 元 Traceback (most recent call last): File "C:\Users\Administrator\AppData\Roaming\Python\Python310\site-packages\pandas\core\indexes\base.py", line 3621, in get_loc return self._engine.get_loc(casted_key) File "pandas\_libs\index.pyx", line 136, in pandas._libs.index.IndexEngine.get_loc File "pandas\_libs\index.pyx", line 142, in pandas._libs.index.IndexEngine.get_loc TypeError: '(slice(None, None, None), None)' is an invalid key During handling of the above exception, another exception occurred: Traceback (most recent call last): File "D:\新建文件夹\02\JDData_month.py", line 51, in <module> plt.plot(x,y_pred, color='blue', linewidth=1.5) #预测回归线 File "C:\Users\Administrator\AppData\Roaming\Python\Python310\site-packages\matplotlib\pyplot.py", line 2757, in plot return gca().plot( File "C:\Users\Administrator\AppData\Roaming\Python\Python310\site-packages\matplotlib\axes\_axes.py", line 1632, in plot lines = [*self._get_lines(*args, data=data, **kwargs)] File "C:\Users\Administrator\AppData\Roaming\Python\Python310\site-packages\matplotlib\axes\_base.py", line 312, in __call__ yield from self._plot_args(this, kwargs) File "C:\Users\Administrator\AppData\Roaming\Python\Python310\site-packages\matplotlib\axes\_base.py", line 487, in _plot_args x = _check_1d(xy[0]) File "C:\Users\Administrator\AppData\Roaming\Python\Python310\site-packages\matplotlib\cbook\__init__.py", line 1327, in _check_1d ndim = x[:, None].ndim File "C:\Users\Administrator\AppData\Roaming\Python\Python310\site-packages\pandas\core\frame.py", line 3506, in __getitem__ indexer = self.columns.get_loc(key) File "C:\Users\Administrator\AppData\Roaming\Python\Python310\site-packages\pandas\core\indexes\base.py", line 3628, in get_loc self._check_indexing_error(key) File "C:\Users\Administrator\AppData\Roaming\Python\Python310\site-packages\pandas\core\indexes\base.py", line 5637, in _check_indexing_error raise InvalidIndexError(key) pandas.errors.InvalidIndexError: (slice(None, None, None), None) 进程已结束,退出代码为 1