环境
运行在jupyter 进行开发。即一个WEB端的开发工具。能适时显示开发的输出。后缀用的是ipynb.pycharm也可以支持。但也要提示按装jupyter.
或直接用andcoda
这里我们用pycharm进行项目创建
pip install -i https://pypi.tuna.tsinghua.edu.cn/simplejupyterlabpip install -i https://pypi.tuna.tsinghua.edu.cn/simplenotebookpip install -i https://pypi.tuna.tsinghua.edu.cn/simple scikit-learnpip install -i https://pypi.tuna.tsinghua.edu.cn/simple pandaspip install -i https://pypi.tuna.tsinghua.edu.cn/simple matplotlib
将以下的文本复制到本地sklearn/data:
sepal_lengthsepal_widthpetal_lengthpetal_widthspecies5.13.51.40.2Iris-setosa4.931.40.2Iris-setosa4.73.21.30.2Iris-setosa4.63.11.50.2Iris-setosa53.61.40.2Iris-setosa5.43.91.70.4Iris-setosa4.63.41.40.3Iris-setosa53.41.50.2Iris-setosa4.42.91.40.2Iris-setosa4.93.11.50.1Iris-setosa5.43.71.50.2Iris-setosa4.83.41.60.2Iris-setosa4.831.40.1Iris-setosa4.331.10.1Iris-setosa5.841.20.2Iris-setosa5.74.41.50.4Iris-setosa5.43.91.30.4Iris-setosa5.13.51.40.3Iris-setosa5.73.81.70.3Iris-setosa5.13.81.50.3Iris-setosa5.43.41.70.2Iris-setosa5.13.71.50.4Iris-setosa4.63.610.2Iris-setosa5.13.31.70.5Iris-setosa4.83.41.90.2Iris-setosa531.60.2Iris-setosa53.41.60.4Iris-setosa5.23.51.50.2Iris-setosa5.23.41.40.2Iris-setosa4.73.21.60.2Iris-setosa4.83.11.60.2Iris-setosa5.43.41.50.4Iris-setosa5.24.11.50.1Iris-setosa5.54.21.40.2Iris-setosa4.93.11.50.2Iris-setosa53.21.20.2Iris-setosa5.53.51.30.2Iris-setosa4.93.61.40.1Iris-setosa4.431.30.2Iris-setosa5.13.41.50.2Iris-setosa53.51.30.3Iris-setosa4.52.31.30.3Iris-setosa4.43.21.30.2Iris-setosa53.51.60.6Iris-setosa5.13.81.90.4Iris-setosa4.831.40.3Iris-setosa5.13.81.60.2Iris-setosa4.63.21.40.2Iris-setosa5.33.71.50.2Iris-setosa53.31.40.2Iris-setosa73.24.71.4Iris-versicolor6.43.24.51.5Iris-versicolor6.93.14.91.5Iris-versicolor5.52.341.3Iris-versicolor6.52.84.61.5Iris-versicolor5.72.84.51.3Iris-versicolor6.33.34.71.6Iris-versicolor4.92.43.31Iris-versicolor6.62.94.61.3Iris-versicolor5.22.73.91.4Iris-versicolor523.51Iris-versicolor5.934.21.5Iris-versicolor62.241Iris-versicolor6.12.94.71.4Iris-versicolor5.62.93.61.3Iris-versicolor6.73.14.41.4Iris-versicolor5.634.51.5Iris-versicolor5.82.74.11Iris-versicolor6.22.24.51.5Iris-versicolor5.62.53.91.1Iris-versicolor5.93.24.81.8Iris-versicolor6.12.841.3Iris-versicolor6.32.54.91.5Iris-versicolor6.12.84.71.2Iris-versicolor6.42.94.31.3Iris-versicolor6.634.41.4Iris-versicolor6.82.84.81.4Iris-versicolor6.7351.7Iris-versicolor62.94.51.5Iris-versicolor5.72.63.51Iris-versicolor5.52.43.81.1Iris-versicolor5.52.43.71Iris-versicolor5.82.73.91.2Iris-versicolor62.75.11.6Iris-versicolor5.434.51.5Iris-versicolor63.44.51.6Iris-versicolor6.73.14.71.5Iris-versicolor6.32.34.41.3Iris-versicolor5.634.11.3Iris-versicolor5.52.541.3Iris-versicolor5.52.64.41.2Iris-versicolor6.134.61.4Iris-versicolor5.82.641.2Iris-versicolor52.33.31Iris-versicolor5.62.74.21.3Iris-versicolor5.734.21.2Iris-versicolor5.72.94.21.3Iris-versicolor6.22.94.31.3Iris-versicolor5.12.531.1Iris-versicolor5.72.84.11.3Iris-versicolor6.33.362.5Iris-virginica5.82.75.11.9Iris-virginica7.135.92.1Iris-virginica6.32.95.61.8Iris-virginica6.535.82.2Iris-virginica7.636.62.1Iris-virginica4.92.54.51.7Iris-virginica7.32.96.31.8Iris-virginica6.72.55.81.8Iris-virginica7.23.66.12.5Iris-virginica6.53.25.12Iris-virginica6.42.75.31.9Iris-virginica6.835.52.1Iris-virginica5.72.552Iris-virginica5.82.85.12.4Iris-virginica6.43.25.32.3Iris-virginica6.535.51.8Iris-virginica7.73.86.72.2Iris-virginica7.72.66.92.3Iris-virginica62.251.5Iris-virginica6.93.25.72.3Iris-virginica5.62.84.92Iris-virginica7.72.86.72Iris-virginica6.32.74.91.8Iris-virginica6.73.35.72.1Iris-virginica7.23.261.8Iris-virginica6.22.84.81.8Iris-virginica6.134.91.8Iris-virginica6.42.85.62.1Iris-virginica7.235.81.6Iris-virginica7.42.86.11.9Iris-virginica7.93.86.42Iris-virginica6.42.85.62.2Iris-virginica6.32.85.11.5Iris-virginica6.12.65.61.4Iris-virginica7.736.12.3Iris-virginica6.33.45.62.4Iris-virginica6.43.15.51.8Iris-virginica634.81.8Iris-virginica6.93.15.42.1Iris-virginica6.73.15.62.4Iris-virginica6.93.15.12.3Iris-virginica5.82.75.11.9Iris-virginica6.83.25.92.3Iris-virginica6.73.35.72.5Iris-virginica6.735.22.3Iris-virginica6.32.551.9Iris-virginica6.535.22Iris-virginica6.23.45.42.3Iris-virginica5.935.11.8Iris-virginica
开发
创建一个jupyter的文件这编程界面出现
写代码:
.ipynb 是 Jupyter Notebook 文件的扩展名。Jupyter Notebook 是一个交互式的 Web 应用程序,用于创建和共享包含实时代码、方程、可视化和叙述性文本的文档。
在 Jupyter Notebook 中,你可以编写 Python 代码,并且代码单元格可以执行。这使得 Jupyter Notebook 成为数据清理、数据分析和可视化、机器学习模型训练等任务的强大工具。
使用 .ipynb 扩展名的原因是因为它表示这个文件是一个 Jupyter Notebook 文件,并且该文件可以使用 Jupyter Notebook 或 JupyterLab 等工具打开和编辑。
此外,Jupyter Notebook 文件也可以保存为 .py 文件,这样它们就可以作为常规的 Python 脚本运行。但是,直接保存为 .py 文件会失去 Jupyter Notebook 的交互性特性,例如代码单元格的执行和实时代码的输出。
import pandas as pddf=pd.read_csv('data/iris.txt',sep='\t')df.head() #前五行df.tail() # 后五行print(df.shape) #行例数print(df.info()) # 数据整体信息print(df.describe()) #统计
#### 相关教程
sklearn介绍