如果日期相同,我想合并我的dataframe的记录。在下面的例子中,我想合并日期(13,14,15),(25,26),(30,31)在一起,因为有连续的日期。我想打破合并记录如果有任何单日休息。
cust date description
CUST123 2020-06-13 observed increased loss rate
CUST123 2020-06-13 cut performed job
CUST123 2020-06-14 working tight area
CUST123 2020-06-15 production shut neighbouring app
CUST123 2020-07-17 loss pressure slow gain trip
CUST123 2020-08-25 established circulation load
CUST123 2020-08-26 performed sticky test
CUST123 2020-08-28 job meeting prior low energy
CUST123 2020-08-30 performed maintenance service
CUST123 2020-08-31 reconnected control line
字符串
期望产量
cust date description
CUST123 2020-06-13 observed increased loss rate cut performed job
working tight area production shut neighbouring app
CUST123 2020-07-17 loss pressure slow gain trip
CUST123 2020-08-25 established circulation load performed sticky test
CUST123 2020-08-28 job meeting prior low energy
CUST123 2020-08-30 performed maintenance service reconnected control line
型
1条答案
按热度按时间b4wnujal1#
如果日期相同,为了合并数据框架的记录,您可以执行以下操作:
字符串
其输出:
型
编辑:如果你想合并连续日期,保留连续范围的第一个日期,你可以这样做:
型
输出量:
型