JayashreeKotte / python-challenge

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Python Challenge

Aim of this project is to use the python skills we learnt and showcase the use in real life applications.

Two real-world scenarios were presented with large data sets to be analyzed using Python programming language. The agenda was to analyze the dataset, calculate the results and export an output text file containing the final results.

PyBank Challenge

In this project, the task was to create a Python script to analyze the financial records of a company.

Anaysis of this dataset included calculation of the following values:

  1. The total number of months included in the dataset.
  2. The net total amount of "Profit/Losses" over the entire period.
  3. The changes in "Profit/Losses" over the entire period, and the average of those changes.
  4. The greatest increase in profits (date and amount) over the entire period.
  5. The greatest decrease in profits (date and amount) over the entire period.

PyPoll Challenge

In this project, the task was to help a small, rural town modernize its vote-counting process. The analysis of the dataset includes calculations of each of the following values:

  1. The total number of votes cast

  2. A complete list of candidates who received votes

  3. The percentage of votes each candidate won

  4. The total number of votes each candidate won

  5. The winner of the election based on popular vote

How to Install and Run the script

To run this script:

  1. Copy the git link in your local directory
  2. Ensure Resources and Analysis directories,main.py file are present
  3. Check, the respective csv datasets are present in the Resources folder
  4. Run the PyBank python script using Visual Studio Code from PyBank directory and check Analysis folder for budget_analysis text file containing the analysis results
  5. Run the PyPoll python script using Visual Studio Code from PyPoll directory and check Analysis folder for election_results text file containing the analysis results
  6. In additon, you could change the csv dataset containing the same columns in Resources folder and run the code to see the results.

Credits

To write these Python scripts, I discussed the average value calculation with my TAs and they helped me write a small portion of the logic to calculate the average value. I also had a very informative Tutoring session, during which I was shown the solution, that inspired some of the ideas for the final script.

Ideas for PyBank script included, saving the first row values (after header row) in variables to aid in final calculations. And net change value calculation. Printing output results using new line (\n) character in the f-print statement and saving the output in a text file.

Idea for PyPoll script included, tracking total votes each candidate received and saving the output in a text file.

References

https://www.entechin.com/how-to-find-the-max-value-in-a-dictionary-in-python/

https://note.nkmk.me/en/python-dict-value-max-min/#:~:text=maximum%20and%20minimum.-,Get%20the%20key%2Dvalue%20pair%20with%20the%20maximum%2Fminimum%20value,tuples%20(key%2C%20value)%20.

https://sparkbyexamples.com/python/get-python-dictionary-values-to-list/#:~:text=Using%20the%20*%20operator%20we%20can,dict%20values%20as%20a%20list.

https://www.freecodecamp.org/news/how-to-write-a-good-readme-file/

About


Languages

Language:Python 100.0%