Permalink
Cannot retrieve contributors at this time
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?
5011CEM_COURSEWORK_CLINTON-EKWUGHA_13293446/3.py
Go to fileThis commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
19 lines (14 sloc)
788 Bytes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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() |