[英]Python - difference iterating over columns
Just wanted a possible solution for iterating a difference over columns.只是想要一个可能的解决方案来迭代列上的差异。 Intuition says a simple for loop should be able to solve it, however, it's been a while and I am super rusty with my syntax etc. Or a group by with a lambda function?
直觉说一个简单的 for 循环应该能够解决它,但是,已经有一段时间了,我对我的语法等非常生疏。或者与 lambda function 组?
Problem statement.问题陈述。
df looks like: df 看起来像:
Obviously working with cohort files.显然使用队列文件。 I want to find the difference for col(n+1) - col(n) and iterate while grouping over the cohort group.
我想找到 col(n+1) - col(n) 的区别,并在对队列组进行分组时进行迭代。
for example for 2014-04 my result should be例如对于 2014-04 我的结果应该是
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.