Analyzing Shipment Schedules
Stryg for at vise menuen
Shipment scheduling and tracking play a critical role in logistics by ensuring that goods move efficiently from origin to destination. Accurate schedules help you coordinate resources, reduce idle time, and meet customer expectations. Tracking shipment progress and analyzing historical data allow you to spot patterns, anticipate potential disruptions, and continuously improve your logistics operations.
1234567891011121314151617181920212223import pandas as pd # Create a DataFrame representing a shipment schedule shipment_data = { 'shipment_id': [101, 102, 103, 104], 'origin': ['Chicago', 'Dallas', 'Atlanta', 'Denver'], 'destination': ['New York', 'Los Angeles', 'Miami', 'Seattle'], 'departure': pd.to_datetime([ '2024-06-01 08:00', '2024-06-01 09:30', '2024-06-01 10:00', '2024-06-01 11:15' ]), 'arrival': pd.to_datetime([ '2024-06-02 14:00', '2024-06-02 22:00', '2024-06-01 22:30', '2024-06-02 19:45' ]) } shipments = pd.DataFrame(shipment_data) print(shipments)
Once you have structured shipment data in a DataFrame, you can analyze on-time performance and delays by comparing scheduled and actual times. Calculate each shipment's duration by subtracting the departure time from the arrival time. If you have expected arrival times, you can measure delays by comparing them to actual arrivals. This analysis helps you identify which shipments are consistently late and understand the causes, enabling proactive improvements in your logistics process.
1234567891011121314151617181920212223242526import matplotlib.pyplot as plt # Calculate shipment durations in hours shipments['duration_hrs'] = (shipments['arrival'] - shipments['departure']).dt.total_seconds() / 3600 # Simulate delays (in hours) for demonstration shipments['expected_arrival'] = shipments['departure'] + pd.to_timedelta([30, 36, 12, 32], unit='h') shipments['delay_hrs'] = (shipments['arrival'] - shipments['expected_arrival']).dt.total_seconds() / 3600 # Plot shipment durations plt.figure(figsize=(10, 5)) plt.bar(shipments['shipment_id'], shipments['duration_hrs'], color='skyblue', label='Duration (hrs)') plt.xlabel('Shipment ID') plt.ylabel('Duration (hours)') plt.title('Shipment Durations') plt.legend() plt.show() # Plot shipment delays plt.figure(figsize=(10, 5)) plt.bar(shipments['shipment_id'], shipments['delay_hrs'], color='salmon', label='Delay (hrs)') plt.xlabel('Shipment ID') plt.ylabel('Delay (hours)') plt.title('Shipment Delays') plt.legend() plt.show()
1. What information is essential for analyzing shipment schedules?
2. How can visualizing shipment delays help improve logistics operations?
3. Fill in the blank: To calculate shipment duration, subtract 'departure' from '____'.
Tak for dine kommentarer!
Spørg AI
Spørg AI
Spørg om hvad som helst eller prøv et af de foreslåede spørgsmål for at starte vores chat