回复内容:
转一篇文章给楼主看下。中文原文:长篇巨献|数据科学界华山论剑:R与Python巅峰对决
英文原文应该是这里:Choosing R or Python for data analysis? An infographic
如果你是数据分析领域的新兵,那么你一定很难抉择——在进行数据分析时,到底应该使用哪个语言,R还是Python?在网络上,也经常出现诸如“我想学习机器语言,我应该用哪个编程语言”或者“我想快速解决问题,我应该用R还是Python”等这类问题。尽管两个编程语言目前都是数据分析社区的佼佼者,但是它们仍在为成为数据科学家的首选编程语言而战斗。今天,就让我们从数据科学的角度,一步步比较这两大编程语言。
#1 对阵双方介绍

R语言当前版本是2015年6月更新的3.2.1版。Python 2当前版本是2015年5月更新的2.7.10版,Python 3当前的版本是2015年2月更新的3.4.3版。







由于Python看重可读性和易用性,使得它的学习曲线相对比较低并且平缓。因此,对于初级程序员,Python 被认为是一个很好的编程语言。对于Python学习者的建议是,尝试用《笨办法学Python》学习的同时看视频做练习。

计算机科学教授Norm Matloff 曾说过,“Python并未建立起一个能与CRAN媲美的巨大的代码库,R在这方面领先巨大。但是,统计学并不是Python的中心任务。”







数据处理能力上,使用R进行数据分析很容易上手,因为它具有庞大数量的包、方便使用的检验以及在使用公式方面的优势。做基本数据分析时,R语言更方便,不需要额外安装包,大的数据库需要使用类似data.table和dplyr包。过去,Python数据分析包的幼年期曾是个问题,但是现在已经得到很大的改善,用Python进行数据分析时,你需要使用NumPy、Pandas和其它的程序包。

如何上手也是比拼的一个方面。R的集成开发环境(IDE)可以选择RStudio。R最受欢迎的程序包有:dply、plyr和data.table(易于操作数据),stringr(易于操作字符串),zoo(处理规则和不规则时间序列),ggvis、lattice和ggplot2(数据可视化),caret(机器学习),建议初学者查看DataCamp上的课程和教程。
Python的集成开发环境(IDE)有很多,其中Spyder和Python Notebook最受欢迎。建议初学者查看Rodeo(被称为“Python到数据科学IDE”)。Python最受欢迎的程序包有:pandas (易于操作数据),SciPy/NumPy(科学计算),sckikit-learn(机器学习),matplotlib(用于作图),statsmodels(数据探索、统计模型估计、统计检验和单元测试)。

[建议]给Python初学者推荐“8步从Python白丁到专家”(点击查看)。若想了解更多Python包,请看“数据科学家之5个最佳Python库,为初学者定制的教程” (点击查看)。
关于技术支持,使用R进行数据分析有很多技术支持,包括Stackoverflow、Rdocumentation,(R文档整合)和R-help 邮件列表。
Python的数据分析问题可以通过以下方式获得支持:Stackoverflow和邮件列表。
邮件列表包括pydata(关于使用Python进行数据分析和Pandas包)、pystatsmodels (Statsmodels和pandas包的问题)、numpy-discussion (Numpy包的问题)和sci-py user(大部分是SciPy或者科学问题)

从整体数据来看,在做数据分析时使用R的人数要多于使用Python(下图左:2014用于数据分析的程序语言)。在2014年,有23.45%的人同时使用R与Python(下图右:2014年R和Python使用分析)。




#3 总决选:优缺点

IPython最大的优点在于,IPython Notebook使得用Python分析数据变得容易,它可以将你的分析放在一个文件中。用Python处理数据可以简化工作流程。它是一个组合,其中包括:交互式Python数据探索、在一个环境下为文档提前写好程序、文本和公式。你可以跟同事分享笔记本,并且不用他们安装任何东西。IPython大大减少了管理代码、输出和笔记本文件的时间,这样可以有更多的时间做实际工作。

Python是一种通用语言,其另一个优点在于它的可读性和学习曲线;同时,Python简单直观,它对可读性的重视更放大了这一特征。这就解释了为什么Python的学习曲线相对平缓,因而很多程序员很熟悉它。并且,你写一个程序的速度也得到正面影响:编程时间更少了,玩耍时间更多了。
Python的测试框架确保代码的可重复性和可靠性,一个内置低壁垒的测试框架能够支持一个很好的测试覆盖率。其测试工具分类包括:UnitTest Python(标准库中首个测试框架)、Nose (UnitTest的扩展,很多程序包使用它,如pandas)、DocTest (基于Python标准解释器的输出很容易生成测试),Pytest (当进行复杂的函数测试时,可以进行小测试)。

与R相比,Python是一个多用途语言。作为一个被大多数程序员所熟知的普遍且易于理解的编程语言,Python也能把不同背景的人聚集到一起。例如,一些机构不想雇佣数据分析师或者雇佣新的数据分析师比较困难,就会培训老员工使用Python。这意味着,Python是一个现成的编程语言,它能够作为一个单独的工具与你工作流程中任意一部分结合。

Python最大的问题在于其可视化,选择数据分析软件时,可视化是一个重要原则。虽然Python有一些很好的可视化程序库,包括:Seaborn(基于matplotlib的程序库)、Bokeh(交互式可视化程序库)和Pygal(建立动态可伸缩向量图形(SVG))。但Python提供的可选择程序库过多,且与R对比,在Python中进行可视化有些复杂,呈现的结果也并不是很令人满意。

Python另一个问题是它还不成熟,造成一种更受限制的方式去思考数据分析。截至目前,没有模块能够代替基本R程序包的100个。Python正在努力克服这一问题, 其中一些解决办法包括:IPython中的R扩展允许在IPython Notebook中方便使用R;现有资源和约定格局充当了一个重要角色:Matlab通常用于发布开放的研究代码,Python用于数学,R 用于统计。Mlabwrap 连接了Python和Matlab,但是有些缺点,因此你需要学会两种程序语言,并且需要有一个Matlab许可证。

其二是他们都是高级工具,很多统计学的新进展会先在R和小范围的Python开源程序包中出现,这比商业平台要早。
第三是它们都提供在线社区,相对商业软件提供收费的用户支持,R和Python利用在线社区对它们相应的用户提供支持。
最后,二者使用者的薪水都比较高,根据O’Reilly 2013数据科学工资调查显示,主要使用开源工具的数据科学家(130,000美元)比使用商业工具的数据科学家(90,000美元)的工资中值更高。

最后的结果是平局!哪个工具更适合,取决于你这个数据科学家如何去挑选一个最适合你需要的程序语言。下面的问题可以指导你做出决定。
1.你要解决什么样的问题
2.你学习一门程序语言的成本?学习一个能更好地解决问题的新系统会花费时间,但依旧使用你熟悉的系统并不能解决你要解决的问题。
3.在你的领域最常用的工具是什么?
在你的领域中还有什么可用的工具,它们和那些常用工具有什么关系?
参考资料

很多数据相关的课程这两年都改用python来完成作业,甚至奥本海默的离散时间信号这种爷爷辈的课都推荐用Python了。
工具这种东西嘛,哪个顺手用哪个就行了,R和Python用好了都很厉害。
不过,ipython+numpy+matplotlib+pylab确实太好用了。。。尤其在*nix下面。 勺子和筷子的关系 数据科学,这范围太广了,编程能力加上统计学数学功底外加不同领域的能力,一般是一个team,各司其职,有做业务需求分析的,有做数据处理,有做机器学习建模的,有做可视化的,所以,这定义太广泛了。仅凭R和python做不了。做数据分析的或者说统计学专业的人更偏重于R,做数据挖掘的工程师或者说计算机专业更喜欢用python,没什么哪个取代哪个,这好比问淘宝能否取代京东一般,一个平台大,一个物流给力,哪个的给顾客更佳的体验就选哪。总的来说,Python更加老牌,R最近非常流行。能学就都学会,知乎上有很多这方面的回答。 我曾经两次试图学R,但看到reshape矩阵都要导入一个包就感觉蛋疼无比,接下来又分不清向量、矩阵、列表、数据框、水平等各种非常类似又略有不同的数据类型,于是晕了,遂弃之。 没听说过胶片相机吧? 没玩儿过单反吧?題主是从智能手机开始拍照片的吧?
不是说从市场层面上没有取代都可能,而是每一次市场方向的选择都会让你恶心很多年,才会逐渐恢复到一个可以看的质量水平。 这个过程是相当恶心的。
同意金志鑫的观点,不要小看物种多样性 MATLAB怎么办 Python+R才是王道

Python is easier to learn and use, while C is more powerful but complex. 1. Python syntax is concise and suitable for beginners. Dynamic typing and automatic memory management make it easy to use, but may cause runtime errors. 2.C provides low-level control and advanced features, suitable for high-performance applications, but has a high learning threshold and requires manual memory and type safety management.

Python and C have significant differences in memory management and control. 1. Python uses automatic memory management, based on reference counting and garbage collection, simplifying the work of programmers. 2.C requires manual management of memory, providing more control but increasing complexity and error risk. Which language to choose should be based on project requirements and team technology stack.

Python's applications in scientific computing include data analysis, machine learning, numerical simulation and visualization. 1.Numpy provides efficient multi-dimensional arrays and mathematical functions. 2. SciPy extends Numpy functionality and provides optimization and linear algebra tools. 3. Pandas is used for data processing and analysis. 4.Matplotlib is used to generate various graphs and visual results.

Whether to choose Python or C depends on project requirements: 1) Python is suitable for rapid development, data science, and scripting because of its concise syntax and rich libraries; 2) C is suitable for scenarios that require high performance and underlying control, such as system programming and game development, because of its compilation and manual memory management.

Python is widely used in data science and machine learning, mainly relying on its simplicity and a powerful library ecosystem. 1) Pandas is used for data processing and analysis, 2) Numpy provides efficient numerical calculations, and 3) Scikit-learn is used for machine learning model construction and optimization, these libraries make Python an ideal tool for data science and machine learning.

Is it enough to learn Python for two hours a day? It depends on your goals and learning methods. 1) Develop a clear learning plan, 2) Select appropriate learning resources and methods, 3) Practice and review and consolidate hands-on practice and review and consolidate, and you can gradually master the basic knowledge and advanced functions of Python during this period.

Key applications of Python in web development include the use of Django and Flask frameworks, API development, data analysis and visualization, machine learning and AI, and performance optimization. 1. Django and Flask framework: Django is suitable for rapid development of complex applications, and Flask is suitable for small or highly customized projects. 2. API development: Use Flask or DjangoRESTFramework to build RESTfulAPI. 3. Data analysis and visualization: Use Python to process data and display it through the web interface. 4. Machine Learning and AI: Python is used to build intelligent web applications. 5. Performance optimization: optimized through asynchronous programming, caching and code

Python is better than C in development efficiency, but C is higher in execution performance. 1. Python's concise syntax and rich libraries improve development efficiency. 2.C's compilation-type characteristics and hardware control improve execution performance. When making a choice, you need to weigh the development speed and execution efficiency based on project needs.


Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

SublimeText3 Linux new version
SublimeText3 Linux latest version

Dreamweaver Mac version
Visual web development tools

ZendStudio 13.5.1 Mac
Powerful PHP integrated development environment

SecLists
SecLists is the ultimate security tester's companion. It is a collection of various types of lists that are frequently used during security assessments, all in one place. SecLists helps make security testing more efficient and productive by conveniently providing all the lists a security tester might need. List types include usernames, passwords, URLs, fuzzing payloads, sensitive data patterns, web shells, and more. The tester can simply pull this repository onto a new test machine and he will have access to every type of list he needs.

SublimeText3 Mac version
God-level code editing software (SublimeText3)