根据数据范围分配财政年度
我试图根据日期范围分配适当的会计年度。 设置会计年度参数 我的数据框架包含索赔记录,其中每个记录显示“生成的日期”,“索赔金额”和“付款金额”。 dataframe 这些列中每一列的数据类型是:
- 日期生成= datetime64 [ns](ex:'2018-10-03')
- 索赔金额= float64(ex:2,948.35)
- 金额付费= float64(ex:2,948.35),
我想创建根据“生成的日期”将每个记录分类为正确的会计年度的新专栏“财政年度”。
我尝试了使用“ pandas剪切”,“ lambda apply”,“ pandas类别”的各种解决方案,但我一直遇到日期范围条件的问题。有人可以帮我吗?谢谢你!
I am trying to assign the appropriate fiscal year based on date ranges.
set fiscal year parameters
My data frame contains records of claims where each record shows the 'Date Generated' , 'Claim Amount', and 'Amount Paid'.
dataframe
The data types for each of those columns is:
- Date Generated = datetime64[ns] (ex: '2018-10-03')
- Claim Amount = float64 (ex: 2,948.35)
- Amount Paid = float64 (ex: 2,948.35)
I want to create a new column 'Fiscal Year' that classifies each record into the correct fiscal year based on the 'Date Generated'.
I've tried a variety of solutions using 'pandas cut', 'lambda apply', 'pandas category' but I keep running into issues with the date range condition. Can someone help me with this? Thank you!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
看起来您的会计年度开始在日历年之前的两个月开始,所以我将在当前日期添加两个月并占用该年度财产
Looks like your fiscal year begins two months before the calendar year, so I'll add two months to the current date and take the year property