我有一个熊猫数据框在一家酒店预订。每一行都是预订,如下所示:
Name Arrival Departure RoomNights
Trent Cotchin 29/10/2017 2/11/2017 4
Dustin Martin 1/11/2017 4/11/2017 3
Alex Rance 2/11/2017 3/11/2017 1
我想使用python来转换,这样每一行就变成一个roomnight。输出如下:
Name Arrival Departure RoomNights RoomNight Date
Trent Cotchin 29/10/2017 2/11/2017 4 29/10/2017
Trent Cotchin 29/10/2017 2/11/2017 4 30/10/2017
Trent Cotchin 29/10/2017 2/11/2017 4 31/10/2017
Trent Cotchin 29/10/2017 2/11/2017 4 1/11/2017
Dustin Martin 1/11/2017 4/11/2017 3 1/11/2017
Dustin Martin 1/11/2017 4/11/2017 3 2/11/2017
Dustin Martin 1/11/2017 4/11/2017 3 3/11/2017
Alex Rance 2/11/2017 3/11/2017 1 2/11/2017
这使我可以轻松地计算出任何给定日/月的总房间夜数。
目前没有回答
相关问题 更多 >
编程相关推荐