博客
关于我
用 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/

你可能感兴趣的文章
npm编译报错You may need an additional loader to handle the result of these loaders
查看>>
npm设置淘宝镜像、升级等
查看>>
npm设置源地址,npm官方地址
查看>>
npm设置镜像如淘宝:http://npm.taobao.org/
查看>>
npm配置安装最新淘宝镜像,旧镜像会errror
查看>>
NPM酷库052:sax,按流解析XML
查看>>
npm错误 gyp错误 vs版本不对 msvs_version不兼容
查看>>
npm错误Error: Cannot find module ‘postcss-loader‘
查看>>
npm,yarn,cnpm 的区别
查看>>
NPOI
查看>>
NPOI之Excel——合并单元格、设置样式、输入公式
查看>>
NPOI初级教程
查看>>
NPOI利用多任务模式分批写入多个Excel
查看>>
NPOI在Excel中插入图片
查看>>
NPOI将某个程序段耗时插入Excel
查看>>
NPOI格式设置
查看>>
NPOI设置单元格格式
查看>>
Npp删除选中行的Macro录制方式
查看>>
NR,NF,FNR
查看>>
nrf24l01+arduino
查看>>