博客
关于我
用 Python 入门数据科学 | Linux 中国
阅读量:305 次
发布时间:2019-03-03

本文共 1725 字,大约阅读时间需要 5 分钟。

Python?????????????

?????????????????????????????????????????????Python??????????????????????????????????????????????????????Python?????????????????????????

??Python????

?????????????????????????????Python???????????????????????????????

python3 -m venv examplesource ./example/bin/activate

??????????example??????????????????????????????????????

??Pandas?NumPy

Pandas?NumPy????????????Pandas????????NumPy??????????????????????

pip3 install pandas

????????????????????????

???????

?????????????????RGB????????sample.csv???

import randomdef rgb():    return random.randint(0, 255) / 255with open('sample.csv', 'w') as f:    f.write('"red","green","blue"\n')    for _ in range(10):        f.write(f'{rgb():.2f},{rgb():.2f},{rgb():.2f}\n')

??Pandas????

Pandas??????CSV????????????????????????????????

from pandas import read_csv, DataFrameimport pandas as pdwith open('sample.csv', 'r') as f:    dataframe = pd.read_csv(f)    dataframe.columns = ['red', 'green', 'blue']    print(dataframe['red'])

??????????????????????

?????

???????????????????????Matplotlib?Seaborn???????????

import matplotlib.pyplot as pltfrom matplotlib import rcParamsimport seaborn as snsplt.use('GTK3Agg')rcParams['figure.figsize'] = 11, 8sns.set_style('darkgrid')with open('sample.csv', 'r') as f:    dataframe = pd.read_csv(f)    dataframe.columns = ['red', 'green', 'blue']plt.plot(dataframe['red'], 'r-')plt.plot(dataframe['green'], 'g-')plt.plot(dataframe['blue'], 'b-')plt.legend(bbox_to_anchor=(1, 1), loc=2, borderaxespad=1)plt.show()

????????????????????????????

??????

???????????????????????

deactivate

???????????????????

????

Pandas?Matplotlib?Seaborn?????????????????????????????????????????????????????????????????????????????????????????

转载地址:http://anpl.baihongyu.com/

你可能感兴趣的文章
NodeJs连接Oracle数据库
查看>>
nodejs配置express服务器,运行自动打开浏览器
查看>>
Nodemon 深入解析与使用
查看>>
node不是内部命令时配置node环境变量
查看>>
node中fs模块之文件操作
查看>>
Node中的Http模块和Url模块的使用
查看>>
Node中自启动工具supervisor的使用
查看>>
Node入门之创建第一个HelloNode
查看>>
node全局对象 文件系统
查看>>
Node出错导致运行崩溃的解决方案
查看>>
Node响应中文时解决乱码问题
查看>>
node基础(二)_模块以及处理乱码问题
查看>>
node安装及配置之windows版
查看>>
Node提示:error code Z_BUF_ERROR,error error -5,error zlib:unexpected end of file
查看>>
Node提示:npm does not support Node.js v12.16.3
查看>>
Node搭建静态资源服务器时后缀名与响应头映射关系的Json文件
查看>>
Node服务在断开SSH后停止运行解决方案(创建守护进程)
查看>>
node模块化
查看>>
Node读取并输出txt文件内容
查看>>
node防xss攻击插件
查看>>