[go: nahoru, domu]

Skip to content

CodeYou-Data-Jan2024/fruit-sales-exercise-LauraTerry

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Open in Visual Studio Code

Fruit Sales

Code Louisville Python programming exercise.

Overview

In this exercise we will create a Pandas Dataframe with fruit sales information and write the data to a CSV file. This exercise is based on the Lesson 1 exercise in the Kaggle Learn Pandas course.

Write a Python program that creates a Pandas Dataframe that matches the table below:

Apples Bananas
2017 Sales 35 21
2018 Sales 41 34

Write the data to a file called fruit.csv in the project directory.

Make sure to add the fruit.csv file to the repo before committing and pushing back to GitHub.

Instructions

  1. Click on the link in the assignment in Google Classroom.
  2. Accept the exercise from GitHub. GitHub will automatically create a new repo for you with an open Pull Request for your changes.
  3. Clone the new repo to your machine.
  4. Create a virtual environment, activate it, and install the required packages. (see instructions below)
  5. Add your code to the specified file.
  6. Add/Commit/Push your code back to GitHub.GitHub will run the automated tests when you push.
  7. Review the Pull Request on your repo to see the status of the tests.
  8. “Turn in” the assignment in Google Classroom.

Virtual Environment Step-by-Step Instructions

  1. After you have cloned the repo to your machine, navigate to the project folder in GitBash/Terminal.
  2. Create a virtual environment in the project folder. python3 -m venv venv 1
  3. Activate the virtual environment. source venv/bin/activate
  4. Install the required packages. pip install -r requirements.txt
  5. When you are done working on your repo, deactivate the virtual environment. deactivate

Optional: Automated Code Testing

This repo contains a small testing program that is automatically run by GitHub to validate your code. This testing program is contained in the tests.py file. You don't have to do anything with this file to complete the exercise, but you can follow these steps if you would like to run the tests on your machine.

  1. Open GitBash in Windows or the Terminal in Mac and navigate to the project folder.
  2. Run the tests. We won't be covering testing with python in this course. Use the following command to run the tests: pytest tests.py. You can read more about it here.
  3. Review the output from running the test. This will let you know whether your code produces the expected results.

Footnotes

  1. GitBash on Windows uses “python” instead of “python3”

About

fruit-sales-exercise-LauraTerry created by GitHub Classroom

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages