美文网首页大数据 爬虫Python AI SqlPython小哥哥
Excel不好吗?为什么非要用Python做数据分析!

Excel不好吗?为什么非要用Python做数据分析!

作者: 14e61d025165 | 来源:发表于2019-07-23 15:45 被阅读12次

如果你对数据分析有所了解,一定听说过一些亲民的工具 如Excel、Tableau、PowerBI等,都能成为数据分析的得力助手。 但它们的不足也是显而易见的: 操作繁琐,复用性差,功能相对局限单一。

怎么解决呢?——Python

Python有很多优点,如果你能很好的运用到工作中,会发现工作效率大大提升,涨薪也是再正常不过的事情。

Python优点一:

Python资源共享群:484031800

流程可控,工作高效

举个例子,Excel做分析的过程:定位空值-删除空值-修改数据格式-去除异常值-公式计算-数据透视表-整理数据-插入图表-调整结果……

繁琐的每一步都是来自鼠标点击, 中间如果一步有误,很多步骤都需要重新调整 ,浪费大量时间。

<tt-image data-tteditor-tag="tteditorTag" contenteditable="false" class="syl1563867906214" data-render-status="finished" data-syl-blot="image" style="box-sizing: border-box; cursor: text; color: rgb(34, 34, 34); font-family: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "WenQuanYi Micro Hei", "Helvetica Neue", Arial, sans-serif; font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-indent: 0px; text-transform: none; white-space: pre-wrap; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(255, 255, 255); text-decoration-style: initial; text-decoration-color: initial; display: block;"> image

<input class="pgc-img-caption-ipt" placeholder="图片描述(最多50字)" value="" style="box-sizing: border-box; outline: 0px; color: rgb(102, 102, 102); position: absolute; left: 187.5px; transform: translateX(-50%); padding: 6px 7px; max-width: 100%; width: 375px; text-align: center; cursor: text; font-size: 12px; line-height: 1.5; background-color: rgb(255, 255, 255); background-image: none; border: 0px solid rgb(217, 217, 217); border-radius: 4px; transition: all 0.2s cubic-bezier(0.645, 0.045, 0.355, 1) 0s;"></tt-image>

用Excel进行简单的描述统计分析,每换一份数据都需要重新操作一遍。

但使用Python编写每一步过程就非常方便 ,统一语言带来记录方法的统一。当分析过程需要修改或者复用,只需要调整设定好的参数就可以。

<tt-image data-tteditor-tag="tteditorTag" contenteditable="false" class="syl1563867906218" data-render-status="finished" data-syl-blot="image" style="box-sizing: border-box; cursor: text; color: rgb(34, 34, 34); font-family: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "WenQuanYi Micro Hei", "Helvetica Neue", Arial, sans-serif; font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-indent: 0px; text-transform: none; white-space: pre-wrap; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(255, 255, 255); text-decoration-style: initial; text-decoration-color: initial; display: block;"> image

<input class="pgc-img-caption-ipt" placeholder="图片描述(最多50字)" value="" style="box-sizing: border-box; outline: 0px; color: rgb(102, 102, 102); position: absolute; left: 187.5px; transform: translateX(-50%); padding: 6px 7px; max-width: 100%; width: 375px; text-align: center; cursor: text; font-size: 12px; line-height: 1.5; background-color: rgb(255, 255, 255); background-image: none; border: 0px solid rgb(217, 217, 217); border-radius: 4px; transition: all 0.2s cubic-bezier(0.645, 0.045, 0.355, 1) 0s;"></tt-image>

使用Python代码可以迅速调用数据,计算需求,并记录每一步过程,方便修改。

如果想做出各种好看的图表,使用Python可视化类工具就可以,几行代码,省时省力,还具有交互功能。如果需要调整也只要修改代码,不用费心费力重新做图。

<tt-image data-tteditor-tag="tteditorTag" contenteditable="false" class="syl1563867906222 ql-align-center" data-render-status="finished" data-syl-blot="image" style="box-sizing: border-box; cursor: text; text-align: left; color: rgb(34, 34, 34); font-family: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "WenQuanYi Micro Hei", "Helvetica Neue", Arial, sans-serif; font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: pre-wrap; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(255, 255, 255); text-decoration-style: initial; text-decoration-color: initial; display: block;"> image

<input class="pgc-img-caption-ipt" placeholder="图片描述(最多50字)" value="" style="box-sizing: border-box; outline: 0px; color: rgb(102, 102, 102); position: absolute; left: 187.5px; transform: translateX(-50%); padding: 6px 7px; max-width: 100%; width: 375px; text-align: center; cursor: text; font-size: 12px; line-height: 1.5; background-color: rgb(255, 255, 255); background-image: none; border: 0px solid rgb(217, 217, 217); border-radius: 4px; transition: all 0.2s cubic-bezier(0.645, 0.045, 0.355, 1) 0s;"></tt-image>

Python优点二:

工具库丰富

Python超高的人气带来了大量的大神,Python工具库可谓应有尽有,也为Python用途广泛打下了优秀的基础。

拿数据分析来说,以Python可视化必知基本库matplotlib为例,光是他的官方gallery就有 26个大类527个样式 ,无论是数量还是质量都能碾压市面上大部分同功能软件。

<tt-image data-tteditor-tag="tteditorTag" contenteditable="false" class="syl1563867906227 ql-align-center" data-render-status="finished" data-syl-blot="image" style="box-sizing: border-box; cursor: text; text-align: left; color: rgb(34, 34, 34); font-family: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "WenQuanYi Micro Hei", "Helvetica Neue", Arial, sans-serif; font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: pre-wrap; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(255, 255, 255); text-decoration-style: initial; text-decoration-color: initial; display: block;"> image

<input class="pgc-img-caption-ipt" placeholder="图片描述(最多50字)" value="" style="box-sizing: border-box; outline: 0px; color: rgb(102, 102, 102); position: absolute; left: 187.5px; transform: translateX(-50%); padding: 6px 7px; max-width: 100%; width: 375px; text-align: center; cursor: text; font-size: 12px; line-height: 1.5; background-color: rgb(255, 255, 255); background-image: none; border: 0px solid rgb(217, 217, 217); border-radius: 4px; transition: all 0.2s cubic-bezier(0.645, 0.045, 0.355, 1) 0s;"></tt-image>

matplotlib官网:https://matplotlib.org/tutorials/index.html

Python优点三:

小白友好,易上手

听到Python,大家觉得是门编程语言,很多人就会有这样的顾虑: 我是非计算机相关专业出身,学习Python编程是不是跑偏啦? 我花大把时间在学习计算机编程上,是不是舍本逐末?

关于这一点大家大可不必担心。 如今各行各业都需要数据分析能力,各行各业都需要Python,且Python的语法非常接近英语, 对小白学习者非常友好,阅读Python代码就像在阅读文章 。 下面我们看一段使用Python制作词云图的代码,非常方便易懂:

<pre spellcheck="false" style="box-sizing: border-box; margin: 5px 0px; padding: 5px 10px; border: 0px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-variant-numeric: inherit; font-variant-east-asian: inherit; font-weight: 400; font-stretch: inherit; font-size: 16px; line-height: inherit; font-family: inherit; vertical-align: baseline; cursor: text; counter-reset: list-1 0 list-2 0 list-3 0 list-4 0 list-5 0 list-6 0 list-7 0 list-8 0 list-9 0; background-color: rgb(240, 240, 240); border-radius: 3px; white-space: pre-wrap; color: rgb(34, 34, 34); letter-spacing: normal; orphans: 2; text-align: left; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;">from pyecharts import WordCloud
name = data_10['关键词'].tolist()
value = data_10['出现频率'].tolist()
wordcloud = WordCloud(width=1300, height=620)
wordcloud.add("", name, value, word_size_range=[20, 100])
wordcloud.render('./参考案例HTML/关键词统计词云图.html')
wordcloud
</pre>

导入词云工具包——设置关键词和出现频率——设置好文字和图片的大小等参数,就能获得一张词云图:

<tt-image data-tteditor-tag="tteditorTag" contenteditable="false" class="syl1563867906234 ql-align-center" data-render-status="finished" data-syl-blot="image" style="box-sizing: border-box; cursor: text; text-align: left; color: rgb(34, 34, 34); font-family: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "WenQuanYi Micro Hei", "Helvetica Neue", Arial, sans-serif; font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: pre-wrap; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(255, 255, 255); text-decoration-style: initial; text-decoration-color: initial; display: block;"> image

<input class="pgc-img-caption-ipt" placeholder="图片描述(最多50字)" value="" style="box-sizing: border-box; outline: 0px; color: rgb(102, 102, 102); position: absolute; left: 187.5px; transform: translateX(-50%); padding: 6px 7px; max-width: 100%; width: 375px; text-align: center; cursor: text; font-size: 12px; line-height: 1.5; background-color: rgb(255, 255, 255); background-image: none; border: 0px solid rgb(217, 217, 217); border-radius: 4px; transition: all 0.2s cubic-bezier(0.645, 0.045, 0.355, 1) 0s;"></tt-image>

可以看到,代码在数据分析工作中能做到更高效、丰富和自由。 事实上代码不仅帮助分析,更能帮助逻辑思维。

说了这么多,如果你不想错过Python这 么好的工具,又担心自学遇到问题无处解决,现在就可以

相关文章

网友评论

    本文标题:Excel不好吗?为什么非要用Python做数据分析!

    本文链接:https://www.haomeiwen.com/subject/khcalctx.html