{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Practice Problems\n", "### Lecture 9\n", "Answer each number in a separate cell\n", "\n", "Rename this notebook with your last name and the lecture \n", " \n", " ex. Cych_B_09\n", " \n", "Turn-in this notebook on Canvas. " ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "1. Pandas: methods and filters \n", " - Import the file 'Datasets/minutes_velocity.csv' into a **Pandas DataFrame**.\n", " - Find the median velocity from this **DataFrame** (use the function **Series.median( )**). Print the median value\n", " - Find the mean velocity (use the function **Series.mean( )**). Print the mean value\n", " - Filter your **DataFrame** to select all the velocities that fall between the median and mean using the 'and' conditional syntax. \n", " - Check your work: find the maximum and minimum velocities in the filtered data frame. Print the maximum and minimum values and compare them to the median and mean.\n", "\n", "2. Functions\n", "\n", " - write a function that takes latitudes (in degrees) and converts them to colatitudes (in radians)\n", " - write a function, that takes two longitudes and returns the difference \n", " - re-write the function **great_circle( )** that calls the two other functions and returns the separation in degrees. (**Hint:** remember that **NumPy** assumes that the units are in radians)\n", "\n", "3. Great circles\n", " - Use your new function to find the angular difference between where you were born and Pinyon Flat (**PF_lat = 33.3,PF_lon = -115.7**).\n", " - There are roughly 111 km in one degree, how many kilometers is the distance between your birthplace and Pinyon Flat? Print the distance\n", "\n", "4. Formatting strings\n", " - set a variable, pi, to the value of **np.pi**\n", " - print the value of pi\n", " - format the value to have four significant digits. \n", " - print out a sentence with the formatted value of $\\pi$ in it. \n", " - multiply $\\pi$ by 50 and use the exponential form of string formatting to print out 4 significant digits." ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] } ], "metadata": { "kernelspec": { "display_name": "Python 3", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.6.7" } }, "nbformat": 4, "nbformat_minor": 2 }