Python学习笔记5-MOSH-6小时-项目

import openpyxl as xlfrom openpyxl.chart import BarChart,Referencewb=xl.load_workbook('transaction.xlsx')sheet=wb['Sheet1']for row in range(2,sheet.max_row+1):cell=sheet.cell(row,3)correct_price=cell.value*0.9correct_price_cell=sheet.cell(row,4)correct_price_cell.value=http://www.kingceram.com/post/correct_pricevalues=Reference(sheet,min_row=2,max_row=sheet.max_row,min_col=4,max_col=4)chart=BarChart()chart.add_data(values)sheet.add_chart(chart,'e2')wb.save('transaction2.xlsx')
作可以阅读文档
让帮我改的新代码,加入了可以输入操作文件夹和命名新文件夹的地方
import openpyxl as xlfrom openpyxl.chart import BarChart, Referencedef process_workbook():filename = input("请输入要处理的Excel文件名:")wb = xl.load_workbook(filename)sheet = wb['Sheet1']for row in range(2, sheet.max_row + 1):cell = sheet.cell(row, 3)correct_price = cell.value * 0.9correct_price_cell = sheet.cell(row, 4)correct_price_cell.value = http://www.kingceram.com/post/correct_pricevalues = Reference(sheet,min_row=2,max_row=sheet.max_row,min_col=4,max_col=4)chart = BarChart()chart.add_data(values)sheet.add_chart(chart, 'e2')new_filename = input("请输入要保存的新Excel文件名:")wb.save(new_filename)process_workbook()
项目2-机器学习子集inthe data into /Test sets-82原则 atheand im proveand tools
Numpy:多维数组
:数据分析库,数据帧是二维的(类似于excel表格,有行和列)
:二维绘图库,创建图形
-Learn:决策树、神经网络
使用一个叫木星的环境编写代码:| Home
转到/下载,他的魅力在于直接会把以上流行的库都安装上也不需要手动去配pip,安装过程中需要自己勾选的5个复选框全部勾选 。第二个写了不推荐也要勾上 。
成功之后我注册了账号,然后mosh老师去 里敲了一行命令行,由于他是mac电脑,我说一下我转化为win11可使用版本的过程
先输入>cd /d D:,切换到D盘,因为我把软件装到了D盘
D:\>
并没有自动打开网页,但是copy::8888/?token=打开
看了如下教程不管用--
看了教程都不行,最后碰巧让我给解决了,我也不懂为啥
无法保存,无法更新名称具体方法如下:
1.先下载
pip uninstall pyzmq
2.在直接安装
pip install pyzmq
显示如下,复制链接打开后就可以正常的save和run了:
(base) C:\Users\郎蕊>pip uninstall pyzmqWARNING: Skipping pyzmq as it is not installed.(base) C:\Users\郎蕊>pip install pyzmqCollecting pyzmqDownloading pyzmq-25.1.0-cp311-cp311-win_amd64.whl (1.1 MB)---------------------------------------- 1.1/1.1 MB 21.7 kB/s eta 0:00:00Installing collected packages: pyzmqSuccessfully installed pyzmq-25.1.0(base) C:\Users\郎蕊>jupyter notebook____| | | |_ ____| |__ _| |_ ___| |_| | '_ \/ _` / _` |_/ -_)\___/| .__/\__,_\__,_|\__\___||_|Read the migration plan to Notebook 7 to learn about the new features and the actions to take if you are using extensions.https://jupyter-notebook.readthedocs.io/en/latest/migrate_to_notebook7.htmlPlease note that updating to Notebook 7 might break some of your extensions.[W 22:38:36.105 NotebookApp] Loading JupyterLab as a classic notebook (v6) extension.[C 22:38:36.105 NotebookApp] You must use Jupyter Server v1 to load JupyterLab as notebook extension. You have v2.5.0 installed.You can fix this by executing:pip install -U "jupyter-server<2.0.0"[I 22:38:38.090 NotebookApp] Serving notebooks from local directory: C:\Users\郎蕊[I 22:38:38.090 NotebookApp] Jupyter Notebook 6.5.4 is running at:[I 22:38:38.090 NotebookApp] http://localhost:8888/?token=fcee76f188e58259df8bcb09142177121a2de8898cd3d79b[I 22:38:38.106 NotebookApp]or http://127.0.0.1:8888/?token=fcee76f188e58259df8bcb09142177121a2de8898cd3d79b[I 22:38:38.106 NotebookApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).[C 22:38:38.168 NotebookApp]To access the notebook, open this file in a browser:file:///C:/Users/%E9%83%8E%E8%95%8A/AppData/Roaming/jupyter/runtime/nbserver-8404-open.htmlOr copy and paste one of these URLs:http://localhost:8888/?token=fcee76f188e58259df8bcb09142177121a2de8898cd3d79bor http://127.0.0.1:8888/?token=fcee76f188e58259df8bcb09142177121a2de8898cd3d79bThis version of python seems to be incorrectly compiled(internal generated filenames are not absolute).This may make the debugger miss breakpoints.Related bug: http://bugs.python.org/issue1666807[I 22:39:45.030 NotebookApp] 302 GET /?token=fcee76f188e58259df8bcb09142177121a2de8898cd3d79b (::1) 0.000000ms[I 22:39:45.071 NotebookApp] Saving file at /PycharmProjects/Untitled.ipynbC:\anaconda\Lib\site-packages\nbformat\__init__.py:128: MissingIDFieldWarning: Code cell is missing an id field, this will become a hard error in future nbformat versions. You may want to use `normalize()` on your notebooks before validations (available since nbformat 5.1.4). Previous versions of nbformat are fixing this issue transparently, and will stop doing so in the future.validate(nb)C:\anaconda\Lib\site-packages\notebook\services\contents\manager.py:353: MissingIDFieldWarning: Code cell is missing an id field, this will become a hard error in future nbformat versions. You may want to use `normalize()` on your notebooks before validations (available since nbformat 5.1.4). Previous versions of nbformat are fixing this issue transparently, and will stop doing so in the future.validate_nb(model['content'])[I 22:40:19.999 NotebookApp] Creating new notebook in /PycharmProjects[I 22:40:21.597 NotebookApp] Kernel started: db2a5c36-1b4d-4408-9b4e-2727cf20ab2a, name: python3This version of python seems to be incorrectly compiled(internal generated filenames are not absolute).This may make the debugger miss breakpoints.Related bug: http://bugs.python.org/issue1666807[I 22:42:22.063 NotebookApp] Saving file at /PycharmProjects/helloworld.ipynb