Skip to content
Permalink
main
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
 
 
Cannot retrieve contributors at this time
import pandas as pd
import matplotlib.pyplot as plt
# Step 1: Load the dataset
trips_data = pd.read_csv("Trips_Full_Data.csv")
# Step 2: Extract columns related to distance-trips
distance_columns = ['Trips <1 Mile', 'Trips 1-25 Miles', 'Trips 25-50 Miles', 'Trips 50-100 Miles',
'Trips 100-250 Miles', 'Trips 250-500 Miles', 'Trips 500+ Miles']
# Step 3: Sum up the number of travelers for each distance category
total_travelers_by_distance = trips_data[distance_columns].sum()
# Step 4: Plot the summed values
plt.figure(figsize=(10, 6))
total_travelers_by_distance.plot(kind='bar', color='skyblue')
plt.title('Total Number of Travelers by Distance-Trips')
plt.xlabel('Distance Trips')
plt.ylabel('Total Number of Travelers')
plt.xticks(rotation=45)
plt.grid(axis='y', linestyle='--', alpha=0.7)
plt.tight_layout()
plt.show()