Skip to content
Permalink
8771a0edd8
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
19 lines (14 sloc) 788 Bytes
import pandas as pd
import plotly.express as px
# Load the dataset
data_file = "/Users/thecreator/Downloads/Trips_by_Distance.csv"
question2 = pd.read_csv(data_file)
# Filter data for trips between 10-25 miles with more than 10,000,000 trips
trips_10_25 = question2.loc[question2['Number of Trips 10-25'] > 10000000, ['Date', 'Number of Trips 10-25']]
# Filter data for trips between 50-100 miles with more than 10,000,000 trips
trips_50_100 = question2.loc[question2['Number of Trips 50-100'] > 10000000, ['Date', 'Number of Trips 50-100']]
# Plot using Plotly Express
fig = px.scatter(trips_10_25, x='Date', y='Number of Trips 10-25', title='Trips 10-25 Miles')
fig.show()
fig = px.scatter(trips_50_100, x='Date', y='Number of Trips 50-100', title='Trips 50-100 Miles')
fig.show()