'How do I get the difference between earliest and latest date & timestamp for a car maintenance using pandas

I want the data based on the TRIP ID, start is when the car gets into service and end is when it leaves. There are both date and timestamp columns.

enter image description here



Solution 1:[1]

Something like this will work:

max = DataFrame.max(axis=NoDefault.no_default, skipna=True, level=None, numeric_only=None, **kwargs)

(and similarly min for the minimum value).

the reference code is here: https://pandas.pydata.org/docs/reference/api/pandas.DataFrame.max.html

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 D.L