Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/leftcoastnerdgirl/introduction_to_python
This project provides an introduction to data analysis using Python.
https://github.com/leftcoastnerdgirl/introduction_to_python
data-comparison data-import for-loop min-max python
Last synced: 5 days ago
JSON representation
This project provides an introduction to data analysis using Python.
- Host: GitHub
- URL: https://github.com/leftcoastnerdgirl/introduction_to_python
- Owner: LeftCoastNerdGirl
- Created: 2023-11-05T19:45:32.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2024-07-19T19:28:30.000Z (4 months ago)
- Last Synced: 2024-07-21T00:15:56.748Z (4 months ago)
- Topics: data-comparison, data-import, for-loop, min-max, python
- Language: Python
- Homepage: https://extension.berkeley.edu/search/publicCourseSearchDetails.do?method=load&courseId=35106003
- Size: 1.56 MB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Introduction to Python
This project is an introduction to using Python to prepare data and perform analysis on it.
The first part of the challenge is called PyBank. The instructions given task the student with creating a Python script to analyze the financial records of the example company. We were given a financial dataset called budget_data.csv. The dataset is composed of two columns: "Date" and "Profit/Losses".
Using Python, the csv datafile is imported and lists for month count and profit are created. Using a for loop to inerate through the dataset, rows are added to both empty lists. A second for loop is used to compare each new entry to the previous one, creating a list of monthly changes. Using max and min functions, we can then determine the months with the greatest increase and greatest decrease, respectively.
![image](https://github.com/user-attachments/assets/dd9b190c-8ecf-4438-8e02-4e61eb241a69)
The second part of the challenge is called PyPoll. In this Challenge, the student is tasked with helping a small, rural town modernize its vote-counting process. We were given a set of poll data called election_data.csv. The dataset is composed of three columns: "Voter ID", "County", and "Candidate".
Python was used to import the csv date file. Lists were created to store data from the file: candidates name, number of votes, and percent of overall votes. Using a for loop, the script moves through each row of data and stores the candidate's information in the created lists. Within the loop, the candidate name in the new row is compared to the list of candidates, to either update the vote count if candidate is listed, or append the candidate if they are not. The output of this loop is a summary of candidate names and their total votes.
In an additional step, a for loop is again used to compare the candidate's total votes to the sum of all votes cast to calcuate the percent of total votes. These datapoints are then used to determine the winning candidate.
![image](https://github.com/user-attachments/assets/7dd3b6d9-fcd8-42a4-8347-6e20441cf82b)