问题标签 [dfply]
For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.
python - 如何在python的dfply包中使用自定义函数
我尝试使用 dfply 包在给定条件下创建一个累加器列,但自定义函数失败。
以钻石数据为例:我想创建一个累加器列,如果价格大于 500,则 +1,否则 +0。
我的代码如下:
预期输出将如下所示:
python - 如何在数据框中对值进行分组和求和?
我有这个数据框(请参考下图)
我想做的是按县分组并对凶杀案的价值求和。例如
如您所见,我总结了具有相同县名的凶杀案的价值
这是我的尝试
但是没有做我想做的事,请有人指导我这个问题。
谢谢
python - 创建具有范围的列,Python
我的数据集是 Churn_Modeling:
我正在寻找一个名为 c_rating 的列,其范围如下:(<500 -="very poor", 500-600="poor", 601-660="fair", 661-780="good", and >= 780 – "excellent").
一些示例数据:按顺序排列:
我正在处理其他代码,所以我的库如下:
我怎样才能做一个 case_when (如在 R 中)但 python 来创建这个列?
python - group_by ModuleNotFoundError:没有名为“dfply.group”的模块;'dfply' 不是一个包
我正在研究 Spyder (Anaconda)。自从我在 Windows 上工作以来,我总是收到几条错误消息。我已经在 Linux 中尝试过这段代码,并且成功了!from dfply import * 效果很好。
在 spyder 我有第一条错误信息
在终端上,当我这样做时: Moulinette_logcomplet.py --help-commands ,我有另一个错误消息
你知道出了什么问题吗?我必须安装一些东西吗?或卸载?谢谢
python - 使用 dfply @dfpipe 创建函数时出错
我有一个数据集“banks”,如果我对列名“jobs”进行分组以检查每个类别的计数,我可以找到以下内容:
指数 | 工作 | 数数 |
---|---|---|
0 | 阿德宁。 | 478 |
1 | 蓝领 | 946 |
2 | 企业家 | 168 |
3 | 保姆 | 112 |
4 | 管理 | 969 |
5 | 退休 | 230 |
6 | 自雇人士 | 183 |
7 | 服务 | 417 |
8 | 学生 | 84 |
9 | 技术员。 | 768 |
我还添加了我正在使用的数据集的前 3 行:年龄、工作、婚姻、教育、默认、余额、住房、贷款、联系人、日、月、持续时间、活动、pdays、previous、poutcome、y 30,失业,已婚,主要,无,1787,无,无,蜂窝,19,十月,79,1,-1,0,未知,无 33,服务,已婚,次要,无,4789,是,是,蜂窝, 11,may,220,1,339,4,failure,no 35,management,single,tertiary,no,1350,yes,no,cellular,16,apr,185,1,330,1,failure,no
我的目的是创建一个可以用于其他列的小函数,因此我尝试使用“dfply”包创建一个函数。
但是,这段代码给了我一个错误,说明如下:
如果我遗漏了什么,请告诉我。
python - 使用 dfply mask() 进行过滤的 Python 函数
我正在尝试在 Python 中创建一个函数,该函数接受未指定数量的条件以在内部使用mask
fromdfply
以过滤掉匹配的行。
然后我想在这个例子中使用两个过滤器来做这样的事情:
目前,我能够运行以下内容:
但是,select_filters2
我想要的非常有限:您只能使用一个过滤器(一列)并且不能更改不等式。如何捕捉这一切?
python - Creating user defined function for joins (Python)
I am looking for an easy way to define a function that will consecutively join tables when ran. I am pretty new to Python, but have been given the task of building out a package that heavily relies on joins to work successfully.
I have done plenty of work in R, but will be finishing this in Python (unless I just hit a wall). The goal is to automate a complete task to where a dataframe could be inserted, pushed through a function, and then a presented in a couple different views. This would require one function for each view. Because of this, there are a
This is horrible, and as I am familiar with dplyr, I'm trying to use dfply to accomplish this.
If anyone has better ideas as to how to go about this, that would be greatly appreciated!
Thanks.