You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

面板数据中投资类型间隔的统计需求及模式识别

面板数据中投资类型间隔统计需求

我需要在**面板数据(panel data)**中统计不同投资类型(invType)之间的间隔。企业投资状态分为三类:

  • 正向投资(Positive)
  • 负向投资(Negative)
  • 无投资(Inactivity)

需完成两项统计任务:

  1. 统计负向投资到正向投资之间的年数总和
  2. 统计负向投资或无投资到正向投资之间的年数总和

统计规则

  • 每次出现正向投资时,计数器重置
  • 所有统计需忽略缺失值

期望输出示例表格

idYearinvType投资类型GapNegPosGapAllPos
120001Negative
120011Negative
120021Negative
120032Positive33
120041Negative
120051Negative
120062Positive22
120071Negative
120081Negative
120091Negative
120103Inactivity
120111Negative
120121Negative
120131Positive26
22000.
22001.
22002.
22003.
220042Positive00
220052Positive00
22006.
22007.
220083Positive00
220092Inactivity
220101Negative
220111Negative
220122Positive23
220131Negative

内容的提问来源于stack exchange,提问作者sampak

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.22 06:31:03