In this assignment you will submit your solutions to the pre-class work from specific sessions from our course. You will also write a brief summary of and reflection on your learning in this unit.
PCW from Session 19
Write a function that accepts two data frames and two arguments as inputs.The first argument should tell the function whether you want to stack two data frames vertically (i.e., by stacking their rows on top of each other), or horizontally.The second argument should tell the function whether you'd like to inner or outer join the two data frames.Use this function to combine two unrelated data frames, and bring the function to class with you.
PCW from Session 20
Download the weather data .csv file from the following link:https://gist.githubusercontent.com/bigsnarfdude/515849391ad37fe593997fe0db98afaa/raw/f663366d17b7d05de61a145bbce7b2b961b3b07f/weather.csvWrite a short piece of code that will:
- Load this CSV data file to a pandas dataframe
- Turn the datafile "upside down":
- I.e., the row becomes the first, the second-to-last becomes the second and so on.
- You'll probably need to use a for loop or a write a recursive function.
PCW from Session 22
Apply the Collatz conjecture to the following numbers:30273For each of the previous cases, compute the total number of iterations you had to apply to algorithm to arrive at number one.
PCW from Session 24
- Create a short piece of code that plots the letters of your name as a scatter plot. The X axis should correspond to the position of the letter in your name (for example, for "Patrick" the X axis would be [1,2,3,4,5,6,7]). The Y axis should correspond to the position of the letter in the english alphabet (for example, the name "Patrick" would be [16, 1, 20, 18, 9, 3, 11]).
- This should take no more than 2 lines of code. If you're using more than that you're overthinking it.
- Your code should use the matplotlib scatterplot function.
- Including nice color schemes is optional but appreciated.
PCW from Session 25
- Download the following dataset which covers imports to India over 8 years.
- Create a sharable Colab notebook.
- Write a short piece of Python code that:
- Loads any necessary packages.
- Reads the datafile into a pandas DataFrame.
- Creates a new pandas DataFrame that contains only imports from the country whose name comes closest to yours in the alphabet. For example, the name "Anya" is closest to the country name "Andorra."
- Creates a scatter plot of the data, plotting the year of import on the x axis, and the value of the product on the y axis. Include axis labels, axis ticks, and a title.
- Run the code to create the plot.
Summary and Reflection
- Write a brief (
- Write a brief (
it will require logging into college website for the reflection unit 3 is a simple unit
Optional Challenge for Extra Scores
In Assignment 2 you wrote a budget calculator. Describe how that assignment would have been easier if you already knew the material from Unit 3. For even more extra scores, rewrite your budget calculator using tools from Unit 3!
There is no template for this assignment. Your assignment submission needs to include the following resources:
- A PDF file must be the first resource and it will include all the answers to the questions above, including all the python code you produce. Make sure that you submit a neat, clearly presented, and easy-to-read PDF. The PDF should be submitted under the name file “student_name.pdf”.
- Your second resource must be the Python codes collected in a single zipped Python/Jupyter Notebook. The Python/Jupyter Notebook should be submitted under the name file “student_name.zip".