随着时间的时间更新值
因此,我有一个复杂的问题,我必须模拟随时间变化(25年) 我的数据范围如下:
年龄 | 性 | edu | statu | exp_y | sal | cost | sal_a | cost_a cost_a |
---|---|---|---|---|---|---|---|---|
26 | f | no | em | 2 | 76 | 100 | 0 | 0 0 |
20 | m | low | unem | 0 | 0 0 | 0 | 287 | 150 |
24 | m | low | unem | 2 | 0 | 0 | 345 | 200 |
24 | m | no | em | 10 | 380 | 150 | 0 0 | 0 |
36 | f | hiegh | em | 18 | 684 | 300 | 0 | 0 |
42 | f | low | em | 17 | 646 | 245 | 0 | 0 |
变更条件为:
if(statu ==“ unem”&然后sal_a> cost_a)然后更新这些变量的值{statu =“ em”,age = age+1,exp_y = exp_y+1,sal = sal_a*(1+0.19*exp_y),cost_a,cost_a,sal_a = 0和sal_a = 0和0和cost_a = 0}
if(statu ==“ em”& sal< cost)so {statu =“ unem”;年龄=年龄+1,sal_a = sal,cost_a = cost,exp_y = exp_y,sal = 0和成本= 0}
任何想法请求,
善意问候
So i have a complexe problem where I have to simulate the change of statu over time (25 years)
my dataframe presented like this:
age | sex | edu | statu | exp_y | sal | cost | sal_a | cost_a |
---|---|---|---|---|---|---|---|---|
26 | f | no | em | 2 | 76 | 100 | 0 | 0 |
20 | m | low | unem | 0 | 0 | 0 | 287 | 150 |
24 | m | low | unem | 2 | 0 | 0 | 345 | 200 |
24 | m | no | em | 10 | 380 | 150 | 0 | 0 |
36 | f | hiegh | em | 18 | 684 | 300 | 0 | 0 |
42 | f | low | em | 17 | 646 | 245 | 0 | 0 |
change conditions are :
if (statu=="unem" & sal_a>cost_a) then update the values of these variables {statu = "em",age=age+1, exp_y=exp_y+1, sal=sal_a*(1+0.19*exp_y), cost=cost_a, sal_a=0 and cost_a=0}
if (statu=="em" & sal<cost) so {statu = "unem" ; age=age+1, sal_a=sal, cost_a=cost, exp_y=exp_y, sal=0 and cost=0}
Any ideas pleas,
kind regards
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
第一个条件,请尝试此情况
对于第二个条件
Try this for the first condition
for the second condition
您可以尝试一下:
这将导致第i-the元素代表I-the年度表的列表。
You can try this:
It will result on a list where the i-th element represents the table for the i-th year.