收藏 | 10个可以快速用Python进行数据分析的小技巧( 七 )

Cufflinks库可以将有强大功能的plotly和拥有灵活性的pandas结合在一起 , 非常便于绘图 。 下面就来看在pandas中如何安装和使用Cufflinks库 。

安装

pip install plotly# Plotly is a pre-requisite before installing cufflinkspip install cufflinks#importing Pandas#importing plotly and cufflinks in offline modeimport cufflinks as cfimport plotly.offlinecf.go_offlinecf.set_config_file(offline=False world_readable=True)

是时候展示泰坦尼克号数据集的魔力了 。

df.iplot

df.iplot vsdf.plot

右侧的可视化显示了静态图表 , 而左侧图表是交互式的 , 更详细 , 并且所有这些在语法上都没有任何重大更改 。

推荐阅读