熊猫-合并/分组按时差仅几秒的行

时间:2020-09-11 12:00:32

标签: python pandas datetime merge pivot-table

我有一个包含这样数据的excel文件(要添加嵌入的照片):

第一张图像仅显示我以前的数据。

File file = new File("c:\\tmp\\abc.txt");       //file =C:\tmp\abc.txt
String filePath= file.getCanonicalPath();       //path= C:\tmp\abc.txt
String str=filePath.replace('\\', '/');         //str= C:/tmp/abc.txt
java.net.URI uri= new java.net.URI(str);        //uri= C:/tmp/abc.txt
uri.getPath();                                  //uri.getPath() = /tmp/abc.txt

我使用数据透视表修改了数据,并使用“日期”作为索引。也许我做了 那里是一个严重的错误,因为现在我有无法解决2天的问题。

使用数据透视表后,在此处检出数据:

<blockquote class="imgur-embed-pub" lang="en" data-id="UMXQTI5"><a href="https://imgur.com/UMXQTI5">View post on imgur.com</a></blockquote><script async src="//s.imgur.com/min/embed.js" charset="utf-8"></script>

现在讨论实际问题,如您所见,仅在几乎 完成所有操作后,在桌子中间,我看到了一个错误。通常,当发生RentPay时, 费用会在同一秒内自动发生。但是很少有错误,其中rentPay和fee是 彼此相距仅一秒钟。这使我的数据透视表完全没用。

请查看付款错误照片:

<blockquote class="imgur-embed-pub" lang="en" data-id="SQkmmfW"><a href="https://imgur.com/SQkmmfW">View post on imgur.com</a></blockquote><script async src="//s.imgur.com/min/embed.js" charset="utf-8"></script>

您可以看到它无法合并这2行,只是因为存在时差。

这是我的代码:

<blockquote class="imgur-embed-pub" lang="en" data-id="3McOndZ"><a href="https://imgur.com/3McOndZ">View post on imgur.com</a></blockquote><script async src="//s.imgur.com/min/embed.js" charset="utf-8"></script>

基本上,我想以某种方式忽略那1秒的差异,并使那些行合并, 我并不在乎这么小的时差,时间在这里并不重要。 恰好有4种错误,所有这些在1秒内都是不同的。

任何想法我该如何解决?

0 个答案:

没有答案