This project provides an interactive Python script to explore US bikeshare data. Users can filter data by city, month, and day of the week, and receive descriptive statistics on various aspects of bikeshare usage.
- Overview
- Date created
- Dataset Information
- Features
- Installation and Setup
- Usage
- Requirements
- Sample Output
- Credit
The bikeshare.py
script allows users to analyze bikeshare data from three major US cities: Chicago, New York City, and Washington. It provides insights such as the most popular travel times, stations, trip durations, and user demographics.
This project and README file were created at 05/11/2024
This project uses CSV files containing bikeshare data for each city:
chicago.csv
new_york_city.csv
washington.csv
The data includes:
- Start Time: Date and time the trip started.
- End Time: Date and time the trip ended.
- Trip Duration: Duration of the trip in seconds.
- Start Station and End Station: Name of the start and end stations.
- User Type: Type of user (Subscriber or Customer).
- Gender and Birth Year: Available only for Chicago and New York City.
- Data Filtering: Choose specific city, month, and day of the week to filter the data.
- Descriptive Statistics:
- Time Statistics: Find the most common month, day, and hour for trips.
- Station Statistics: Find the most popular start and end stations and the most frequent combination of stations.
- Trip Duration Statistics: Display total, mean, median, min, max, and standard deviation of trip durations.
- User Statistics: Show counts of user types, gender distribution, and birth year data.
- Raw Data Display: Optionally display 5 rows of raw data at a time.
-
Clone the repository to your local machine.
bash
Copy code
git clone https://github.com/rabbithunter0502/pdsnd_github.git
-
Navigate to the project directory.
bash
Copy code
cd pdsnd_github
-
Make sure you have Python 3 and pandas installed. You can install the required library with:
bash
Copy code
pip install pandas
-
Ensure the CSV files (
chicago.csv
,new_york_city.csv
,washington.csv
) are in the project directory.
Run the script from the command line:
bash
Copy code
python bikeshare.py
- City Selection: Choose a city (Chicago, New York City, or Washington).
- Filter Options:
- Month: Choose a month (January to June) or "all" for no filter.
- Day of Week: Choose a day (e.g., Monday) or "all" for no filter.
- Statistics Output: The script will display the relevant statistics.
- Raw Data Display: You'll be prompted to view 5 rows of raw data iteratively.
- Python 3.x
pandas
library
To install pandas:
bash
Copy code
pip install pandas
After filtering, the script displays statistics like:
plaintext
Copy code
`Calculating The Most Frequent Times of Travel...
Most common month: June Most common day of week: Wednesday Most common start hour: 17
Calculating The Most Popular Stations and Trip...
Most commonly used start station: Columbus Circle Most commonly used end station: Central Park Most frequent trip combination: Columbus Circle to Central Park`
For additional raw data, the script will prompt:
plaintext
Copy code
Would you like to see 5 lines of raw data? Enter yes or no: