-
Notifications
You must be signed in to change notification settings - Fork 27
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
【推荐】datar: dplyr in python #23
Comments
Wow! 很棒的工具,这个是需要R包支持,还是完全在Python中实现的呢? |
logo 示例: from datar import f
from datar.dplyr import mutate, filter, if_else
from datar.tibble import tibble
# or
# from datar.all import f, mutate, filter, if_else, tibble
df = tibble(
x=range(4),
y=['zero', 'one', 'two', 'three']
)
df >> mutate(z=f.x)
"""# output
x y z
<int64> <object> <int64>
0 0 zero 0
1 1 one 1
2 2 two 2
3 3 three 3
"""
df >> mutate(z=if_else(f.x>1, 1, 0))
"""# output:
x y z
<int64> <object> <int64>
0 0 zero 0
1 1 one 0
2 2 two 1
3 3 three 1
"""
df >> filter(f.x>1)
"""# output:
x y
<int64> <object>
0 2 two
1 3 three
"""
df >> mutate(z=if_else(f.x>1, 1, 0)) >> filter(f.z==1)
"""# output:
x y z
<int64> <object> <int64>
0 2 two 1
1 3 three 1
""" |
Purely in python, backended by pandas. No |
这就厉害了。我看到example中的 感谢分享。 |
|
Closed
好的,将在第二期进行推荐。 谢谢。 该issue将关闭。 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
推荐分类
推荐内容
在生信分析中,
R
是很常用的语言,R
中数据处理的包,特别是tidyverse
开发的包,包括dplyr, tidyr, forcats等,很受欢迎。他们的API设计简单易记,配合ggplot
,简直数据分析+作图的神组合。而python
中,pandas
虽然强大,但API繁多且不容易记住。datar
将R
中相关的包在python
中进行了实现,使得python
中的数据分析也可以用上dplyr
的语法。datar
不仅实现了管道操作,并且尽量遵循原包的API设计,对R熟悉的同学很容易上手。The text was updated successfully, but these errors were encountered: