R和PYTHON怎么比较

版主: hci

头像
wokao
论坛元老
论坛元老
帖子互动: 995
帖子: 20298
注册时间: 2023年 3月 11日 19:17

#21 Re: R和PYTHON怎么比较

帖子 wokao »

我原来用R
现在用julia
即便统计函数,julia足够了

python有的流行package
就是julia写的
fieldman 写了: 2024年 5月 5日 08:26 R多年前风头很旺,大有把业界大佬SAS挤垮的趋势,据说现在要被巨蟒搞定了?
fieldman楼主
论坛精英
论坛精英
帖子互动: 433
帖子: 6577
注册时间: 2023年 3月 17日 20:27

#22 Re: R和PYTHON怎么比较

帖子 fieldman楼主 »

教授用什么放在一边,我更感兴趣的是业界比较大规模的,成熟的application用什么, 那些可能不需要非常新的算法。

可以直接把R放在HPC上用,也可以用python, 甚至更低级的语言,反正实现一个较通用的algorithm也不是什么门槛很高的东西。

hci 写了: 2024年 5月 5日 11:14 搞不定。

R在统计学中的地位,还不能被撼動,主要是统计学教授只用R,相关的学科,也是如此。比如心理系的研究生们,大都会R。

会R,python就也会了,反之不然。
fieldman楼主
论坛精英
论坛精英
帖子互动: 433
帖子: 6577
注册时间: 2023年 3月 17日 20:27

#23 Re: R和PYTHON怎么比较

帖子 fieldman楼主 »

天哪,这又产生了 julia和python的选择问题了!
wokao 写了: 2024年 5月 5日 12:51 我原来用R
现在用julia
即便统计函数,julia足够了

python有的流行package
就是julia写的
头像
wokao
论坛元老
论坛元老
帖子互动: 995
帖子: 20298
注册时间: 2023年 3月 11日 19:17

#24 Re: R和PYTHON怎么比较

帖子 wokao »

python适合machine learning

统计分析三个差不了多少,R多一些,对我都够用了

语言本身,r的大括弧和python的缩进让人不舒服



fieldman 写了: 2024年 5月 5日 13:19 天哪,这又产生了 julia和python的选择问题了!
上次由 wokao 在 2024年 5月 5日 13:41 修改。
头像
tongmeng(mengmeng)
知名作家
知名作家
帖子互动: 39
帖子: 1011
注册时间: 2022年 7月 28日 02:35

#25 Re: R和PYTHON怎么比较

帖子 tongmeng(mengmeng) »

fieldman 写了: 2024年 5月 5日 08:26 R多年前风头很旺,大有把业界大佬SAS挤垮的趋势,据说现在要被巨蟒搞定了?
我现在不再用SAS了
人生最大的智慧是希望和等待
头像
pseudo(small man)
论坛点评
论坛点评
pseudo 的博客
帖子互动: 142
帖子: 2601
注册时间: 2022年 7月 28日 10:04

#26 Re: R和PYTHON怎么比较

帖子 pseudo(small man) »

fieldman 写了: 2024年 5月 5日 08:26 R多年前风头很旺,大有把业界大佬SAS挤垮的趋势,据说现在要被巨蟒搞定了?
个人而言,更喜欢R:主要是喜欢 bigtable 胜过 python 的 pandas。经常吐槽 pandas,太难用了。

希望科学计算这块将来会统一到 Julia。对了,Julia 的内核本质也是 Lisp。
头像
VladPutin(清风不识字何故乱翻书)
论坛支柱
论坛支柱
VladPutin 的博客
帖子互动: 1455
帖子: 12876
注册时间: 2022年 7月 24日 11:12

#27 Re: R和PYTHON怎么比较

帖子 VladPutin(清风不识字何故乱翻书) »

这俩都不是一种东西怎么比较?
图片
头像
pseudo(small man)
论坛点评
论坛点评
pseudo 的博客
帖子互动: 142
帖子: 2601
注册时间: 2022年 7月 28日 10:04

#28 Re: R和PYTHON怎么比较

帖子 pseudo(small man) »

fieldman 写了: 2024年 5月 5日 08:26 R多年前风头很旺,大有把业界大佬SAS挤垮的趋势,据说现在要被巨蟒搞定了?
说实在的,大公司就应该用 SAS,丑是丑一点,但非常适合不是统计专业的人使用,稳定而且提供的选项多。

折腾 Python 就是搞笑,把搞数据分析的人逼成 IT 砖家干嘛?
头像
wokao
论坛元老
论坛元老
帖子互动: 995
帖子: 20298
注册时间: 2023年 3月 11日 19:17

#29 Re: R和PYTHON怎么比较

帖子 wokao »

用duckdb
只需要sql

R python julia都可以用duckdb

pseudo 写了: 2024年 5月 5日 14:10 个人而言,更喜欢R:主要是喜欢 bigtable 胜过 python 的 pandas。经常吐槽 pandas,太难用了。

希望科学计算这块将来会统一到 Julia。对了,Julia 的内核本质也是 Lisp。
wyseman
著名点评
著名点评
帖子互动: 148
帖子: 3631
注册时间: 2022年 7月 21日 21:51

#30 Re: R和PYTHON怎么比较

帖子 wyseman »

tongmeng 写了: 2024年 5月 5日 13:37 我现在不再用SAS了
我还天天用sas
fieldman楼主
论坛精英
论坛精英
帖子互动: 433
帖子: 6577
注册时间: 2023年 3月 17日 20:27

#31 Re: R和PYTHON怎么比较

帖子 fieldman楼主 »

有那么点意思。我个人也不喜欢学很多小众语言的syntax, 所以在R里用一些sqlite, sqldf之类的接口,无奈太慢了。duckdb速度如何?看来需要研究研究。

wokao 写了: 2024年 5月 5日 14:47 用duckdb
只需要sql

R python julia都可以用duckdb
头像
wokao
论坛元老
论坛元老
帖子互动: 995
帖子: 20298
注册时间: 2023年 3月 11日 19:17

#32 Re: R和PYTHON怎么比较

帖子 wokao »

fieldman 写了: 2024年 5月 5日 14:57 有那么点意思。我个人也不喜欢学很多小众语言的syntax, 所以在R里用一些sqlite, sqldf之类的接口,无奈太慢了。duckdb速度如何?看来需要研究研究。
sqldf很慢,R里最快的是data.table,现在polars也支持R了。

下边的是polars做的benchmark,没包括data.table,可以假设两者速度差不多。如果包括了读数据文件的时间,polars最快,duckdb其次;不包括读数据文件时间,duckdb更快。pandas要慢很多。

https://pola.rs/posts/benchmarks/
owl
著名写手
著名写手
帖子互动: 16
帖子: 322
注册时间: 2022年 7月 23日 18:56

#33 Re: R和PYTHON怎么比较

帖子 owl »

免费的R性能不行,商业的底层不一样,性能好很多
wildthing 写了: 2024年 5月 5日 11:19 R semantics is quite strange. Maybe due to historical reasons it is still popular. Its interface is quite pleasant and support for data operation is strong. On the other hand, performance is quite poor compared to Python. It may never go away. Python is stupid in its own right.
头像
wokao
论坛元老
论坛元老
帖子互动: 995
帖子: 20298
注册时间: 2023年 3月 11日 19:17

#34 Re: R和PYTHON怎么比较

帖子 wokao »

“performance is quite poor compared to Python”

胡说八道,python缺省是link 到openblas,miniconda连到mkl,R连到自带的简陋线性代数库,但是可以很方便就连到openblas和mkl,然后R和Python就没有性能差异了,毕竟Python已经很慢,R即便比蜗牛慢也慢不了多少。实际上R的popular库大多是用C/C++写的

wildthing 写了: 2024年 5月 5日 11:19 R semantics is quite strange. Maybe due to historical reasons it is still popular. Its interface is quite pleasant and support for data operation is strong. On the other hand, performance is quite poor compared to Python. It may never go away. Python is stupid in its own right.
wildthing
著名点评
著名点评
帖子互动: 273
帖子: 4511
注册时间: 2022年 7月 22日 14:25

#35 Re: R和PYTHON怎么比较

帖子 wildthing »

wokao 写了: 2024年 5月 5日 19:37 “performance is quite poor compared to Python”

胡说八道,python缺省是link 到openblas,miniconda连到mkl,R连到自带的简陋线性代数库,但是可以很方便就连到openblas和mkl,然后R和Python就没有性能差异了,毕竟Python已经很慢,R即便比蜗牛慢也慢不了多少。实际上R的popular库大多是用C/C++写的
Just compare the dataframe of R and dataframe of Pandas. The performance difference is quite obvious.

I don't know why you have to use blas. If you have to use blas, you might as well use cublas, which is much better.

We are talking about performance of native code, not C libraries. The whole argument of R has good performance because the libraries are in C is complete bullshit. Python has numpy, which has excellent performance in most cases.
司马光在《资治通鉴》中说日本人:'知小礼而无大义,拘小节而无大德。重末节而无廉耻,畏威而不怀德。强必盗寇,弱必卑伏'。
康熙皇帝在《康熙朝起居注》中这样评论日本人:“倭子国,最是反复无常之国。其人,甚卑贱,不知世上有恩谊,只一味慑于武威……故尔,不得对其有稍许好颜色。”

图片
头像
pseudo(small man)
论坛点评
论坛点评
pseudo 的博客
帖子互动: 142
帖子: 2601
注册时间: 2022年 7月 28日 10:04

#36 Re: R和PYTHON怎么比较

帖子 pseudo(small man) »

wokao 写了: 2024年 5月 5日 14:47 用duckdb
只需要sql

R python julia都可以用duckdb
多谢,让我来试试。

如果用duckdb,Python 里面一般的函数都接受 duckdb 类型的数据输入吗?
头像
wokao
论坛元老
论坛元老
帖子互动: 995
帖子: 20298
注册时间: 2023年 3月 11日 19:17

#37 Re: R和PYTHON怎么比较

帖子 wokao »

dataframe
https://h2oai.github.io/db-benchmark/
R的data.table比pandas快得多, dplyr和pandas速度相当,但是语法要舒服很多

你大概是文科生,上了个统计课,用了一把R,和里边教学用的dataframe,然后就开始胡说八道了

至于什么用blas,更是胡说八道。你用numpy实际是要调用blas的,只不过Python安装的时候偷偷往你机器里安装了OpenBlas/MKL。跟R一样,Python里边有速度要求的numpy和scipy都是C/C++写的

R和Python都是解释性语言,都慢。想快,用Julia。

你应该跑英文bbs去练英文,跑这里真滑稽。
wildthing 写了: 2024年 5月 5日 20:19 Just compare the dataframe of R and dataframe of Pandas. The performance difference is quite obvious.

I don't know why you have to use blas. If you have to use blas, you might as well use cublas, which is much better.

We are talking about performance of native code, not C libraries. The whole argument of R has good performance because the libraries are in C is complete bullshit. Python has numpy, which has excellent performance in most cases.
上次由 wokao 在 2024年 5月 6日 06:39 修改。
头像
wokao
论坛元老
论坛元老
帖子互动: 995
帖子: 20298
注册时间: 2023年 3月 11日 19:17

#38 Re: R和PYTHON怎么比较

帖子 wokao »

julia是这样的:duckdb里边的table和Julia的DataFrame可以相互转换

SQL = "

"
df_combined = DuckDB.execute(con, SQL) |> DataFrame

DuckDB.register_data_frame(con, dfGDP, "GDP")

Python其实和DuckDB的说明书要长很多,应该更强大

pseudo 写了: 2024年 5月 6日 03:15 多谢,让我来试试。

如果用duckdb,Python 里面一般的函数都接受 duckdb 类型的数据输入吗?
wildthing
著名点评
著名点评
帖子互动: 273
帖子: 4511
注册时间: 2022年 7月 22日 14:25

#39 Re: R和PYTHON怎么比较

帖子 wildthing »

Python is compiled to a virtual machine language. It's not purely interpreted.

The original purpose of pandas is to improve the slow dataframe speed of R. You should read the paper by pandas author.

I study programming language for a living though I don't know much about R except it's pretty horrible.

Insulting my English doesn't make what you said true.

wokao 写了: 2024年 5月 6日 06:26 dataframe
https://h2oai.github.io/db-benchmark/
R的data.table比pandas快得多, dplyr和pandas速度相当,但是语法要舒服很多

你大概是文科生,上了个统计课,用了一把R,和里边教学用的dataframe,然后就开始胡说八道了

至于什么用blas,更是胡说八道。你用numpy实际是要调用blas的,只不过Python安装的时候偷偷往你机器里安装了OpenBlas/MKL。跟R一样,Python里边有速度要求的numpy和scipy都是C/C++写的

R和Python都是解释性语言,都慢。想快,用Julia。

你应该跑英文bbs去练英文,跑这里真滑稽。
司马光在《资治通鉴》中说日本人:'知小礼而无大义,拘小节而无大德。重末节而无廉耻,畏威而不怀德。强必盗寇,弱必卑伏'。
康熙皇帝在《康熙朝起居注》中这样评论日本人:“倭子国,最是反复无常之国。其人,甚卑贱,不知世上有恩谊,只一味慑于武威……故尔,不得对其有稍许好颜色。”

图片
头像
wokao
论坛元老
论坛元老
帖子互动: 995
帖子: 20298
注册时间: 2023年 3月 11日 19:17

#40 Re: R和PYTHON怎么比较

帖子 wokao »

别扯淡了,py到pyc不算编译,那是解释器产生的,仅仅是为了日后解释器运行的时候load快一点。用一个版本的python 解释器产生的pyc没法被新版本python解释器解释,需要重新处理py文件产生pyc。很多解释语言都干这事。这跟java有本质不同。

你既然不咋懂r就不用评论了。

pandas比r中教学用的dataframe快,但是用r的不用那个dataframe干活。





wildthing 写了: 2024年 5月 6日 08:06 Python is compiled to a virtual machine language. It's not purely interpreted.

The original purpose of pandas is to improve the slow dataframe speed of R. You should read the paper by pandas author.

I study programming language for a living though I don't know much about R except it's pretty horrible.

Insulting my English doesn't make what you said true.
回复

回到 “葵花宝典(Programming)”