data_list = [
    # ["P", 1582800872.5714748, 900.0],
    # ["P", 1582800873.9544747, 901.0],
    # ["P", 1582800875.2924745, 902.0],
    ["D", 1582800876.1994746, 884],
    ["P", 1582800876.6494749, 903.0],
    ["P", 1582800877.9834747, 904.0],
    ["P", 1582800879.3204746, 905.0],
    ["P", 1582800880.6554747, 906.0],
    ["D", 1582800881.2394748, 850],
    ["P", 1582800881.9874747, 907.0],
    ["P", 1582800883.3204746, 908.0],
    ["P", 1582800884.6524746, 909.0],
    ["P", 1582800885.9864748, 910.0],
    ["D", 1582800886.2944748, 816],
    ["P", 1582800887.3214748, 911.0],
    ["P", 1582800888.6534748, 912.0],
    ["P", 1582800889.9854748, 913.0],
    ["D", 1582800891.3194747, 782],
    ["P", 1582800891.3184748, 914.0],
    ["P", 1582800892.6504748, 915.0],
    ["P", 1582800893.9834747, 916.0],
    ["P", 1582800895.3154747, 917.0],
    ["D", 1582800896.3754747, 748],
    ["P", 1582800896.6484747, 918.0],
    ["P", 1582800897.9814749, 919.0],
    ["P", 1582800899.313475, 920.0],
    ["P", 1582800900.645475, 921.0],
    ["D", 1582800901.4144747, 714],
]

for i, v in enumerate(data_list):
    if v[0] == "P":
        start_list = data_list[i:]
        break
for i, v in enumerate(reversed(data_list)):
    if v[0] == "P":
        if i == 0:
            end_list = start_list
        else:
            end_list = start_list[:-i]
        break

print(end_list)

data_list = [
    # ["P", 1582800872.5714748, 900.0],
    # ["P", 1582800873.9544747, 901.0],
    # ["P", 1582800875.2924745, 902.0],
    ["D", 1582800876.1994746, 884],
    ["P", 1582800876.6494749, 903.0],
    ["P", 1582800877.9834747, 904.0],
    ["P", 1582800879.3204746, 905.0],
    ["P", 1582800880.6554747, 906.0],
    ["D", 1582800881.2394748, 850],
    ["P", 1582800881.9874747, 907.0],
    ["P", 1582800883.3204746, 908.0],
    ["P", 1582800884.6524746, 909.0],
    ["P", 1582800885.9864748, 910.0],
    ["D", 1582800886.2944748, 816],
    ["P", 1582800887.3214748, 911.0],
    ["P", 1582800888.6534748, 912.0],
    ["P", 1582800889.9854748, 913.0],
    ["D", 1582800891.3194747, 782],
    ["P", 1582800891.3184748, 914.0],
    ["P", 1582800892.6504748, 915.0],
    ["P", 1582800893.9834747, 916.0],
    ["P", 1582800895.3154747, 917.0],
    ["D", 1582800896.3754747, 748],
    ["P", 1582800896.6484747, 918.0],
    ["P", 1582800897.9814749, 919.0],
    ["P", 1582800899.313475, 920.0],
    ["P", 1582800900.645475, 921.0],
    ["D", 1582800901.4144747, 714],
]

for i, v in enumerate(data_list):
    if v[0] == "P":
        start_list = data_list[i:]
        break
for i, v in enumerate(reversed(data_list)):
    if v[0] == "P":
        if i == 0:
            end_list = start_list
        else:
            end_list = start_list[:-i]
        break

print(end_list)

# ["P", 1582800872.5714748, 900.0], # ["P", 1582800873.9544747, 901.0], # ["P", 1582800875.2924745, 902.0],