diff --git a/06_Stats/US_Baby_Names/Exercises.ipynb b/06_Stats/US_Baby_Names/Exercises.ipynb index f9f79e7ae..f6f75016f 100644 --- a/06_Stats/US_Baby_Names/Exercises.ipynb +++ b/06_Stats/US_Baby_Names/Exercises.ipynb @@ -23,9 +23,7 @@ { "cell_type": "code", "execution_count": null, - "metadata": { - "collapsed": false - }, + "metadata": {}, "outputs": [], "source": [] }, @@ -46,9 +44,7 @@ { "cell_type": "code", "execution_count": null, - "metadata": { - "collapsed": false - }, + "metadata": {}, "outputs": [], "source": [] }, @@ -62,9 +58,7 @@ { "cell_type": "code", "execution_count": null, - "metadata": { - "collapsed": false - }, + "metadata": {}, "outputs": [], "source": [] }, @@ -78,9 +72,7 @@ { "cell_type": "code", "execution_count": null, - "metadata": { - "collapsed": false - }, + "metadata": {}, "outputs": [], "source": [] }, @@ -88,15 +80,13 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "### Step 6. Is there more male or female names in the dataset?" + "### Step 6. What year has the highest number of baby names in the dataset?" ] }, { "cell_type": "code", "execution_count": null, - "metadata": { - "collapsed": false - }, + "metadata": {}, "outputs": [], "source": [] }, @@ -104,15 +94,13 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "### Step 7. Group the dataset by name and assign to names" + "### Step 7. Is there more male or female names in the dataset?" ] }, { "cell_type": "code", "execution_count": null, - "metadata": { - "collapsed": false - }, + "metadata": {}, "outputs": [], "source": [] }, @@ -120,15 +108,13 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "### Step 8. How many different names exist in the dataset?" + "### Step 8. Group the dataset by name and assign to names" ] }, { "cell_type": "code", "execution_count": null, - "metadata": { - "collapsed": false - }, + "metadata": {}, "outputs": [], "source": [] }, @@ -136,15 +122,13 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "### Step 9. What is the name with most occurrences?" + "### Step 9. How many different names exist in the dataset?" ] }, { "cell_type": "code", "execution_count": null, - "metadata": { - "collapsed": false - }, + "metadata": {}, "outputs": [], "source": [] }, @@ -152,15 +136,13 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "### Step 10. How many different names have the least occurrences?" + "### Step 10. What is the name with most occurrences?" ] }, { "cell_type": "code", "execution_count": null, - "metadata": { - "collapsed": false - }, + "metadata": {}, "outputs": [], "source": [] }, @@ -168,15 +150,13 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "### Step 11. What is the median name occurrence?" + "### Step 11. How many different names have the least occurrences?" ] }, { "cell_type": "code", "execution_count": null, - "metadata": { - "collapsed": false - }, + "metadata": {}, "outputs": [], "source": [] }, @@ -184,15 +164,13 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "### Step 12. What is the standard deviation of names?" + "### Step 12. What is the median name occurrence?" ] }, { "cell_type": "code", "execution_count": null, - "metadata": { - "collapsed": false - }, + "metadata": {}, "outputs": [], "source": [] }, @@ -200,15 +178,27 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "### Step 13. Get a summary with the mean, min, max, std and quartiles." + "### Step 13. What is the standard deviation of names?" ] }, { "cell_type": "code", "execution_count": null, - "metadata": { - "collapsed": false - }, + "metadata": {}, + "outputs": [], + "source": [] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "### Step 14. Get a summary with the mean, min, max, std and quartiles." + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, "outputs": [], "source": [] } @@ -216,23 +206,23 @@ "metadata": { "anaconda-cloud": {}, "kernelspec": { - "display_name": "Python [default]", + "display_name": "Python 3", "language": "python", - "name": "python2" + "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", - "version": 2 + "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", - "pygments_lexer": "ipython2", - "version": "2.7.11" + "pygments_lexer": "ipython3", + "version": "3.9.1" } }, "nbformat": 4, - "nbformat_minor": 0 + "nbformat_minor": 1 } diff --git a/06_Stats/US_Baby_Names/Exercises_with_solutions.ipynb b/06_Stats/US_Baby_Names/Exercises_with_solutions.ipynb index f83fecad6..5ae8e7175 100644 --- a/06_Stats/US_Baby_Names/Exercises_with_solutions.ipynb +++ b/06_Stats/US_Baby_Names/Exercises_with_solutions.ipynb @@ -57,13 +57,15 @@ "\n", "RangeIndex: 1016395 entries, 0 to 1016394\n", "Data columns (total 7 columns):\n", - "Unnamed: 0 1016395 non-null int64\n", - "Id 1016395 non-null int64\n", - "Name 1016395 non-null object\n", - "Year 1016395 non-null int64\n", - "Gender 1016395 non-null object\n", - "State 1016395 non-null object\n", - "Count 1016395 non-null int64\n", + " # Column Non-Null Count Dtype \n", + "--- ------ -------------- ----- \n", + " 0 Unnamed: 0 1016395 non-null int64 \n", + " 1 Id 1016395 non-null int64 \n", + " 2 Name 1016395 non-null object\n", + " 3 Year 1016395 non-null int64 \n", + " 4 Gender 1016395 non-null object\n", + " 5 State 1016395 non-null object\n", + " 6 Count 1016395 non-null int64 \n", "dtypes: int64(4), object(3)\n", "memory usage: 54.3+ MB\n" ] @@ -90,6 +92,19 @@ "data": { "text/html": [ "
\n", + "\n", "\n", " \n", " \n", @@ -247,6 +262,19 @@ "data": { "text/html": [ "
\n", + "\n", "
\n", " \n", " \n", @@ -331,13 +359,41 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "### Step 6. Are there more male or female names in the dataset?" + "### Step 6. What year has the highest number of baby names in the dataset?" ] }, { "cell_type": "code", "execution_count": 5, "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "Count 2007\n", + "dtype: int64" + ] + }, + "execution_count": 5, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "baby_names.groupby(\"Year\").sum().idxmax()" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "### Step 7. Are there more male or female names in the dataset?" + ] + }, + { + "cell_type": "code", + "execution_count": 6, + "metadata": {}, "outputs": [ { "data": { @@ -347,7 +403,7 @@ "Name: Gender, dtype: int64" ] }, - "execution_count": 5, + "execution_count": 6, "metadata": {}, "output_type": "execute_result" } @@ -360,12 +416,12 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "### Step 7. Group the dataset by name and assign to names" + "### Step 8. Group the dataset by name and assign to names" ] }, { "cell_type": "code", - "execution_count": 6, + "execution_count": 7, "metadata": {}, "outputs": [ { @@ -379,6 +435,19 @@ "data": { "text/html": [ "
\n", + "\n", "
\n", " \n", " \n", @@ -425,7 +494,7 @@ "Isabella 204798" ] }, - "execution_count": 6, + "execution_count": 7, "metadata": {}, "output_type": "execute_result" } @@ -451,12 +520,12 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "### Step 8. How many different names exist in the dataset?" + "### Step 9. How many different names exist in the dataset?" ] }, { "cell_type": "code", - "execution_count": 7, + "execution_count": 8, "metadata": {}, "outputs": [ { @@ -465,7 +534,7 @@ "17632" ] }, - "execution_count": 7, + "execution_count": 8, "metadata": {}, "output_type": "execute_result" } @@ -480,12 +549,12 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "### Step 9. What is the name with most occurrences?" + "### Step 10. What is the name with most occurrences?" ] }, { "cell_type": "code", - "execution_count": 8, + "execution_count": 9, "metadata": {}, "outputs": [ { @@ -494,7 +563,7 @@ "'Jacob'" ] }, - "execution_count": 8, + "execution_count": 9, "metadata": {}, "output_type": "execute_result" } @@ -511,12 +580,12 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "### Step 10. How many different names have the least occurrences?" + "### Step 11. How many different names have the least occurrences?" ] }, { "cell_type": "code", - "execution_count": 9, + "execution_count": 10, "metadata": {}, "outputs": [ { @@ -525,7 +594,7 @@ "2578" ] }, - "execution_count": 9, + "execution_count": 10, "metadata": {}, "output_type": "execute_result" } @@ -538,18 +607,31 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "### Step 11. What is the median name occurrence?" + "### Step 12. What is the median name occurrence?" ] }, { "cell_type": "code", - "execution_count": 10, + "execution_count": 11, "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", + "\n", "
\n", " \n", " \n", @@ -583,210 +665,10 @@ " \n", " \n", " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", " \n", " \n", " \n", " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", " \n", " \n", " \n", @@ -812,74 +694,24 @@ "" ], "text/plain": [ - " Count\n", - "Name \n", - "Aishani 49\n", - "Alara 49\n", - "Alysse 49\n", - "Ameir 49\n", - "Anely 49\n", - "Antonina 49\n", - "Aveline 49\n", - "Aziah 49\n", - "Baily 49\n", - "Caleah 49\n", - "Carlota 49\n", - "Cristine 49\n", - "Dahlila 49\n", - "Darvin 49\n", - "Deante 49\n", - "Deserae 49\n", - "Devean 49\n", - "Elizah 49\n", - "Emmaly 49\n", - "Emmanuela 49\n", - "Envy 49\n", - "Esli 49\n", - "Fay 49\n", - "Gurshaan 49\n", - "Hareem 49\n", - "Iven 49\n", - "Jaice 49\n", - "Jaiyana 49\n", - "Jamiracle 49\n", - "Jelissa 49\n", - "... ...\n", - "Kyndle 49\n", - "Kynsley 49\n", - "Leylanie 49\n", - "Maisha 49\n", - "Malillany 49\n", - "Mariann 49\n", - "Marquell 49\n", - "Maurilio 49\n", - "Mckynzie 49\n", - "Mehdi 49\n", - "Nabeel 49\n", - "Nalleli 49\n", - "Nassir 49\n", - "Nazier 49\n", - "Nishant 49\n", - "Rebecka 49\n", - "Reghan 49\n", - "Ridwan 49\n", - "Riot 49\n", - "Rubin 49\n", - "Ryatt 49\n", - "Sameera 49\n", - "Sanjuanita 49\n", - "Shalyn 49\n", - "Skylie 49\n", - "Sriram 49\n", - "Trinton 49\n", - "Vita 49\n", - "Yoni 49\n", - "Zuleima 49\n", + " Count\n", + "Name \n", + "Aishani 49\n", + "Alara 49\n", + "Alysse 49\n", + "Ameir 49\n", + "Anely 49\n", + "... ...\n", + "Sriram 49\n", + "Trinton 49\n", + "Vita 49\n", + "Yoni 49\n", + "Zuleima 49\n", "\n", "[66 rows x 1 columns]" ] }, - "execution_count": 10, + "execution_count": 11, "metadata": {}, "output_type": "execute_result" } @@ -892,21 +724,21 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "### Step 12. What is the standard deviation of names?" + "### Step 13. What is the standard deviation of names?" ] }, { "cell_type": "code", - "execution_count": 11, + "execution_count": 12, "metadata": {}, "outputs": [ { "data": { "text/plain": [ - "11006.069467891111" + "11006.06946789057" ] }, - "execution_count": 11, + "execution_count": 12, "metadata": {}, "output_type": "execute_result" } @@ -919,18 +751,31 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "### Step 13. Get a summary with the mean, min, max, std and quartiles." + "### Step 14. Get a summary with the mean, min, max, std and quartiles." ] }, { "cell_type": "code", - "execution_count": 12, + "execution_count": 13, "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", + "\n", "
49
Antonina49
Aveline49
Aziah49
Baily49
Caleah49
Carlota49
Cristine49
Dahlila49
Darvin49
Deante49
Deserae49
Devean49
Elizah49
Emmaly49
Emmanuela49
Envy49
Esli49
Fay49
Gurshaan49
Hareem49
Iven49
Jaice49
Jaiyana49
Jamiracle49
Jelissa49
......
Kyndle49
Kynsley49
Leylanie49
Maisha49
Malillany49
Mariann49
Marquell49
Maurilio49
Mckynzie49
Mehdi49
Nabeel49
Nalleli49
Nassir49
Nazier49
Nishant49
Rebecka49
Reghan49
Ridwan49
Riot49
Rubin49
Ryatt49
Sameera49
Sanjuanita49
Shalyn49
Skylie49
Sriram49
\n", " \n", " \n", @@ -987,7 +832,7 @@ "max 242874.000000" ] }, - "execution_count": 12, + "execution_count": 13, "metadata": {}, "output_type": "execute_result" } @@ -1014,7 +859,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.7.3" + "version": "3.9.1" }, "toc": { "base_numbering": 1, diff --git a/06_Stats/US_Baby_Names/Solutions.ipynb b/06_Stats/US_Baby_Names/Solutions.ipynb index 9acac382e..55569c62e 100644 --- a/06_Stats/US_Baby_Names/Solutions.ipynb +++ b/06_Stats/US_Baby_Names/Solutions.ipynb @@ -23,9 +23,7 @@ { "cell_type": "code", "execution_count": 1, - "metadata": { - "collapsed": false - }, + "metadata": {}, "outputs": [], "source": [] }, @@ -46,9 +44,7 @@ { "cell_type": "code", "execution_count": 2, - "metadata": { - "collapsed": false - }, + "metadata": {}, "outputs": [ { "name": "stdout", @@ -57,13 +53,15 @@ "\n", "RangeIndex: 1016395 entries, 0 to 1016394\n", "Data columns (total 7 columns):\n", - "Unnamed: 0 1016395 non-null int64\n", - "Id 1016395 non-null int64\n", - "Name 1016395 non-null object\n", - "Year 1016395 non-null int64\n", - "Gender 1016395 non-null object\n", - "State 1016395 non-null object\n", - "Count 1016395 non-null int64\n", + " # Column Non-Null Count Dtype \n", + "--- ------ -------------- ----- \n", + " 0 Unnamed: 0 1016395 non-null int64 \n", + " 1 Id 1016395 non-null int64 \n", + " 2 Name 1016395 non-null object\n", + " 3 Year 1016395 non-null int64 \n", + " 4 Gender 1016395 non-null object\n", + " 5 State 1016395 non-null object\n", + " 6 Count 1016395 non-null int64 \n", "dtypes: int64(4), object(3)\n", "memory usage: 54.3+ MB\n" ] @@ -81,14 +79,25 @@ { "cell_type": "code", "execution_count": 3, - "metadata": { - "collapsed": false - }, + "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", + "\n", "
\n", " \n", " \n", @@ -238,14 +247,25 @@ { "cell_type": "code", "execution_count": 4, - "metadata": { - "collapsed": false - }, + "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", + "\n", "
\n", " \n", " \n", @@ -322,15 +342,39 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "### Step 6. Are there more male or female names in the dataset?" + "### Step 6. What year has the highest number of baby names in the dataset?" ] }, { "cell_type": "code", "execution_count": 5, - "metadata": { - "collapsed": false - }, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "Count 2007\n", + "dtype: int64" + ] + }, + "execution_count": 5, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "### Step 7. Are there more male or female names in the dataset?" + ] + }, + { + "cell_type": "code", + "execution_count": 5, + "metadata": {}, "outputs": [ { "data": { @@ -351,15 +395,13 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "### Step 7. Group the dataset by name and assign to names" + "### Step 8. Group the dataset by name and assign to names" ] }, { "cell_type": "code", "execution_count": 6, - "metadata": { - "collapsed": false - }, + "metadata": {}, "outputs": [ { "name": "stdout", @@ -429,15 +471,13 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "### Step 8. How many different names exist in the dataset?" + "### Step 9. How many different names exist in the dataset?" ] }, { "cell_type": "code", "execution_count": 7, - "metadata": { - "collapsed": false - }, + "metadata": {}, "outputs": [ { "data": { @@ -456,15 +496,13 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "### Step 9. What is the name with most occurrences?" + "### Step 10. What is the name with most occurrences?" ] }, { "cell_type": "code", "execution_count": 8, - "metadata": { - "collapsed": false - }, + "metadata": {}, "outputs": [ { "data": { @@ -483,15 +521,13 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "### Step 10. How many different names have the least occurrences?" + "### Step 11. How many different names have the least occurrences?" ] }, { "cell_type": "code", "execution_count": 9, - "metadata": { - "collapsed": false - }, + "metadata": {}, "outputs": [ { "data": { @@ -510,15 +546,13 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "### Step 11. What is the median name occurrence?" + "### Step 12. What is the median name occurrence?" ] }, { "cell_type": "code", "execution_count": 10, - "metadata": { - "collapsed": false - }, + "metadata": {}, "outputs": [ { "data": { @@ -864,15 +898,13 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "### Step 12. What is the standard deviation of names?" + "### Step 13. What is the standard deviation of names?" ] }, { "cell_type": "code", "execution_count": 11, - "metadata": { - "collapsed": false - }, + "metadata": {}, "outputs": [ { "data": { @@ -891,15 +923,13 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "### Step 13. Get a summary with the mean, min, max, std and quartiles." + "### Step 14. Get a summary with the mean, min, max, std and quartiles." ] }, { "cell_type": "code", "execution_count": 12, - "metadata": { - "collapsed": false - }, + "metadata": {}, "outputs": [ { "data": { @@ -972,23 +1002,36 @@ "metadata": { "anaconda-cloud": {}, "kernelspec": { - "display_name": "Python [default]", + "display_name": "Python 3", "language": "python", - "name": "python2" + "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", - "version": 2 + "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", - "pygments_lexer": "ipython2", - "version": "2.7.12" + "pygments_lexer": "ipython3", + "version": "3.9.1" + }, + "toc": { + "base_numbering": 1, + "nav_menu": {}, + "number_sections": true, + "sideBar": true, + "skip_h1_title": false, + "title_cell": "Table of Contents", + "title_sidebar": "Contents", + "toc_cell": false, + "toc_position": {}, + "toc_section_display": true, + "toc_window_display": false } }, "nbformat": 4, - "nbformat_minor": 0 + "nbformat_minor": 1 } diff --git a/07_Visualization/Chipotle/Solutions.ipynb b/07_Visualization/Chipotle/Solutions.ipynb index 23e7498b3..971e2e109 100644 --- a/07_Visualization/Chipotle/Solutions.ipynb +++ b/07_Visualization/Chipotle/Solutions.ipynb @@ -50,11 +50,7 @@ "execution_count": 2, "metadata": {}, "outputs": [], - "source": [ - "url = 'https://raw.githubusercontent.com/justmarkham/DAT8/master/data/chipotle.tsv'\n", - " \n", - "chipo = pd.read_csv(url, sep = '\\t')" - ] + "source": [] }, { "cell_type": "markdown", @@ -214,9 +210,7 @@ "output_type": "execute_result" } ], - "source": [ - "chipo.head(10)" - ] + "source": [] }, { "cell_type": "markdown", @@ -243,30 +237,7 @@ "output_type": "display_data" } ], - "source": [ - "# get the Series of the names\n", - "x = chipo.item_name\n", - "\n", - "# use the Counter class from collections to create a dictionary with keys(text) and frequency\n", - "letter_counts = Counter(x)\n", - "\n", - "# convert the dictionary to a DataFrame\n", - "df = pd.DataFrame.from_dict(letter_counts, orient='index')\n", - "\n", - "# sort the values from the top to the least value and slice the first 5 items\n", - "df = df[0].sort_values(ascending = True)[45:50]\n", - "\n", - "# create the plot\n", - "df.plot(kind='bar')\n", - "\n", - "# Set the title and labels\n", - "plt.xlabel('Items')\n", - "plt.ylabel('Number of Times Ordered')\n", - "plt.title('Most ordered Chipotle\\'s Items')\n", - "\n", - "# show the plot\n", - "plt.show()" - ] + "source": [] }, { "cell_type": "markdown", @@ -304,23 +275,7 @@ "output_type": "display_data" } ], - "source": [ - "# create a list of prices\n", - "chipo.item_price = [float(value[1:-1]) for value in chipo.item_price] # strip the dollar sign and trailing space\n", - "\n", - "# then groupby the orders and sum\n", - "orders = chipo.groupby('order_id').sum()\n", - "\n", - "# creates the scatterplot\n", - "# plt.scatter(orders.quantity, orders.item_price, s = 50, c = 'green')\n", - "plt.scatter(x = orders.item_price, y = orders.quantity, s = 50, c = 'green')\n", - "\n", - "# Set the title and labels\n", - "plt.xlabel('Order Price')\n", - "plt.ylabel('Items ordered')\n", - "plt.title('Number of items ordered per order price')\n", - "plt.ylim(0)" - ] + "source": [] }, { "cell_type": "markdown", @@ -353,9 +308,9 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.6.8" + "version": "3.9.1" } }, "nbformat": 4, "nbformat_minor": 1 -} \ No newline at end of file +}