我有以下数据框,其中每一行代表一辆自行车租赁:
(持续时间以秒为单位)
我对熊猫和大数据非常陌生。我试图找出目前使用自行车最多的具体时间,以及最大值是多少。你知道吗
精确到小时和分钟的时间。*
租期从60秒到17270400秒不等(199天)
数据帧共有67.000行。你知道吗
我知道解决方案可能很琐碎,但我已经思考和寻找了一段时间,我坚持这个。你知道吗
以下是.csv的一些数据(从文件的顶部、中部和结尾选择了一些记录,以使数据具有一点多样性)
http://pastebin.com/Tgnupe7K
编辑:用.csv文件中的一些原始数据添加了pastebin
Tags:
这里的想法是考虑每辆自行车进入和退出使用的时间,表示进入使用为+1,退出使用为-1。取这些时间,对它们进行排序,然后在+1/-1上取一个累积和。累积和的最大值将给出给定时间内自行车的最大数量。你知道吗
我将使用我模拟的一些数据作为示例:
程序如下:
在上面的代码中,
max_dt
将产生自行车达到最大值的开始时间。要找到结束时间,只需查看bike_times
中的下一个索引值。你知道吗相关问题 更多 >
编程相关推荐