简体   繁体   English

Python Outlook (MAPI) 获取回复邮件的响应时间

[英]Python Outlook (MAPI) Get Response Time of Mails Replied

I was using the ConversationID of the mails in the Inbox and the mails in the Sent Items , assuming that the IDs will be same for the mails that we replied to, and it is same but the problem begins with Email Chains (or the Re: mails aka Conversations).我正在使用Inbox中邮件的ConversationID和已发送邮件中的Sent Items ,假设我们回复的邮件的 ID 相同,并且相同,但问题始于 Email 链(或回复:邮件又名对话)。

Since the ID remains the same, and people keep replying even after days, performing a simple datetime - datetime (with same ConversationIDs) results in outputs such as -1Day 20:05:01 , -9Days etc.由于 ID 保持不变,而且人们即使在几天后仍会继续回复,所以执行简单的datetime - datetime (具有相同的 ConversationID)会产生-1Day 20:05:01-9Days等输出。

I just want to find the Response time of first reply to any mail, that enters the inbox.我只想找到进入收件箱的任何邮件的第一次回复的响应时间。

(Sorry, cannot share Code). (抱歉,无法共享代码)。

To get the Response Time from a Chain of Mails which all have exactly the same ConversationID (generated automatically by Outlook), I did the following:为了从具有完全相同ConversationID (由 Outlook 自动生成)的邮件链中获取响应时间,我执行了以下操作:

I already had two Pandas DFs (let's say 'A' and 'B'), having the two columns each, namely: ConversationID and Time (for received and sent mails).我已经有两个 Pandas DF(比如说“A”和“B”),每个都有两列,即: ConversationIDTime (用于接收和发送的邮件)。

Now,现在,

  1. Created a Pandas DataFrame 'C' with an inner join of 'A' and 'B' on `ConversationID'.创建了一个 Pandas DataFrame 'C',在“ConversationID”上具有“A”和“B”的内部连接。 (This gave me all the mails that I had replied to). (这给了我所有我回复过的邮件)。

  2. Sort the both the Time columns as "Ascending".将两个Time列排序为“升序”。 (This brings the First Mail received and the First Mail replied to the top). (这会将收到的第一封邮件和第一封邮件回复到顶部)。

  3. Now filter the new DataFrame 'C' on both Time columns with the condition, Replied Mail Time > Received Mail Time (Removes the -1 day outputs I was getting)现在过滤两个Time列上的新 DataFrame 'C' 条件, Replied Mail Time > Received Mail Time (删除我得到的 -1 天输出)

  4. Groupby on Received Mail Time and use .first() (Finally giving a genuine response time, after calculating Replied Mail Time - Received Mail Time ) Groupby on Received Mail Time并使用.first() (在计算Replied Mail Time - Received Mail Time后,最后给出真正的响应时间)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM