{ "metadata": { "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.8.3-final" }, "orig_nbformat": 2, "kernelspec": { "name": "python3", "display_name": "Python 3", "language": "python" } }, "nbformat": 4, "nbformat_minor": 2, "cells": [ { "source": [ "## Linear and Polynomial Regression for Pumpkin Pricing - Lesson 3\n", "\n", "Load up required libraries and dataset. Convert the data to a dataframe containing a subset of the data: \n", "\n", "- Only get pumpkins priced by the bushel\n", "- Convert the date to a month\n", "- Calculate the price to be an average of high and low prices\n", "- Convert the price to reflect the pricing by bushel quantity" ], "cell_type": "markdown", "metadata": {} }, { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [ { "output_type": "execute_result", "data": { "text/plain": [ " City Name Type Package Variety Sub Variety Grade Date \\\n", "0 BALTIMORE NaN 24 inch bins NaN NaN NaN 4/29/17 \n", "1 BALTIMORE NaN 24 inch bins NaN NaN NaN 5/6/17 \n", "2 BALTIMORE NaN 24 inch bins HOWDEN TYPE NaN NaN 9/24/16 \n", "3 BALTIMORE NaN 24 inch bins HOWDEN TYPE NaN NaN 9/24/16 \n", "4 BALTIMORE NaN 24 inch bins HOWDEN TYPE NaN NaN 11/5/16 \n", "\n", " Low Price High Price Mostly Low ... Unit of Sale Quality Condition \\\n", "0 270.0 280.0 270.0 ... NaN NaN NaN \n", "1 270.0 280.0 270.0 ... NaN NaN NaN \n", "2 160.0 160.0 160.0 ... NaN NaN NaN \n", "3 160.0 160.0 160.0 ... NaN NaN NaN \n", "4 90.0 100.0 90.0 ... NaN NaN NaN \n", "\n", " Appearance Storage Crop Repack Trans Mode Unnamed: 24 Unnamed: 25 \n", "0 NaN NaN NaN E NaN NaN NaN \n", "1 NaN NaN NaN E NaN NaN NaN \n", "2 NaN NaN NaN N NaN NaN NaN \n", "3 NaN NaN NaN N NaN NaN NaN \n", "4 NaN NaN NaN N NaN NaN NaN \n", "\n", "[5 rows x 26 columns]" ], "text/html": "
\n | City Name | \nType | \nPackage | \nVariety | \nSub Variety | \nGrade | \nDate | \nLow Price | \nHigh Price | \nMostly Low | \n... | \nUnit of Sale | \nQuality | \nCondition | \nAppearance | \nStorage | \nCrop | \nRepack | \nTrans Mode | \nUnnamed: 24 | \nUnnamed: 25 | \n
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
0 | \nBALTIMORE | \nNaN | \n24 inch bins | \nNaN | \nNaN | \nNaN | \n4/29/17 | \n270.0 | \n280.0 | \n270.0 | \n... | \nNaN | \nNaN | \nNaN | \nNaN | \nNaN | \nNaN | \nE | \nNaN | \nNaN | \nNaN | \n
1 | \nBALTIMORE | \nNaN | \n24 inch bins | \nNaN | \nNaN | \nNaN | \n5/6/17 | \n270.0 | \n280.0 | \n270.0 | \n... | \nNaN | \nNaN | \nNaN | \nNaN | \nNaN | \nNaN | \nE | \nNaN | \nNaN | \nNaN | \n
2 | \nBALTIMORE | \nNaN | \n24 inch bins | \nHOWDEN TYPE | \nNaN | \nNaN | \n9/24/16 | \n160.0 | \n160.0 | \n160.0 | \n... | \nNaN | \nNaN | \nNaN | \nNaN | \nNaN | \nNaN | \nN | \nNaN | \nNaN | \nNaN | \n
3 | \nBALTIMORE | \nNaN | \n24 inch bins | \nHOWDEN TYPE | \nNaN | \nNaN | \n9/24/16 | \n160.0 | \n160.0 | \n160.0 | \n... | \nNaN | \nNaN | \nNaN | \nNaN | \nNaN | \nNaN | \nN | \nNaN | \nNaN | \nNaN | \n
4 | \nBALTIMORE | \nNaN | \n24 inch bins | \nHOWDEN TYPE | \nNaN | \nNaN | \n11/5/16 | \n90.0 | \n100.0 | \n90.0 | \n... | \nNaN | \nNaN | \nNaN | \nNaN | \nNaN | \nNaN | \nN | \nNaN | \nNaN | \nNaN | \n
5 rows × 26 columns
\n\n | Month | \nVariety | \nCity | \nPackage | \nLow Price | \nHigh Price | \nPrice | \n
---|---|---|---|---|---|---|---|
70 | \n1 | \n3 | \n1 | \n0 | \n5 | \n3 | \n13.636364 | \n
71 | \n1 | \n3 | \n1 | \n0 | \n10 | \n7 | \n16.363636 | \n
72 | \n2 | \n3 | \n1 | \n0 | \n10 | \n7 | \n16.363636 | \n
73 | \n2 | \n3 | \n1 | \n0 | \n9 | \n6 | \n15.454545 | \n
74 | \n2 | \n3 | \n1 | \n0 | \n5 | \n3 | \n13.636364 | \n