{ "cells": [ { "cell_type": "code", "execution_count": 3, "metadata": { "collapsed": false }, "outputs": [ ], "source": [ "import pandas as pd" ] }, { "cell_type": "code", "execution_count": 4, "metadata": { "collapsed": false }, "outputs": [ ], "source": [ "df=pd.read_excel('SampleData.xlsx')" ] }, { "cell_type": "code", "execution_count": 5, "metadata": { "collapsed": false }, "outputs": [ { "data": { "text/html": [ "
\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", "
OrderDateRegionRepItemUnitsUnit CostTotal
02016-01-06EastJonesPencil951.99189.05
12016-01-23CentralKivellBinder5019.99999.50
22016-02-09CentralJardinePencil364.99179.64
32016-02-26CentralGillPen2719.99539.73
42016-03-15WestSorvinoPencil562.99167.44
\n", "
" ], "text/plain": [ " OrderDate Region Rep Item Units Unit Cost Total\n", "0 2016-01-06 East Jones Pencil 95 1.99 189.05\n", "1 2016-01-23 Central Kivell Binder 50 19.99 999.50\n", "2 2016-02-09 Central Jardine Pencil 36 4.99 179.64\n", "3 2016-02-26 Central Gill Pen 27 19.99 539.73\n", "4 2016-03-15 West Sorvino Pencil 56 2.99 167.44" ] }, "execution_count": 5, "metadata": { }, "output_type": "execute_result" } ], "source": [ "df.head()" ] }, { "cell_type": "code", "execution_count": 6, "metadata": { "collapsed": false }, "outputs": [ ], "source": [ "df_Central=df[df['Region']=='Central']" ] }, { "cell_type": "code", "execution_count": 7, "metadata": { "collapsed": false }, "outputs": [ { "data": { "text/html": [ "
\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", " \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", "
OrderDateRegionRepItemUnitsUnit CostTotal
12016-01-23CentralKivellBinder5019.99999.50
22016-02-09CentralJardinePencil364.99179.64
32016-02-26CentralGillPen2719.99539.73
62016-04-18CentralAndrewsPencil751.99149.25
72016-05-05CentralJardinePencil904.99449.10
102016-06-25CentralMorganPencil904.99449.10
142016-09-01CentralSmithDesk2125.00250.00
162016-10-05CentralMorganBinder288.99251.72
192016-11-25CentralKivellPen Set964.99479.04
202016-12-12CentralSmithPencil671.2986.43
222017-01-15CentralGillBinder468.99413.54
232017-02-01CentralSmithBinder8715.001305.00
262017-03-24CentralJardinePen Set504.99249.50
272017-04-10CentralAndrewsPencil661.99131.34
292017-05-14CentralGillPencil531.2968.37
302017-05-31CentralGillBinder808.99719.20
312017-06-17CentralKivellDesk5125.00625.00
332017-07-21CentralMorganPen Set5512.49686.95
342017-08-07CentralKivellPen Set4223.951005.90
362017-09-10CentralGillPencil71.299.03
392017-10-31CentralAndrewsPencil141.2918.06
402017-11-17CentralJardineBinder114.9954.89
412017-12-04CentralJardineBinder9419.991879.06
422017-12-21CentralAndrewsBinder284.99139.72
\n", "
" ], "text/plain": [ " OrderDate Region Rep Item Units Unit Cost Total\n", "1 2016-01-23 Central Kivell Binder 50 19.99 999.50\n", "2 2016-02-09 Central Jardine Pencil 36 4.99 179.64\n", "3 2016-02-26 Central Gill Pen 27 19.99 539.73\n", "6 2016-04-18 Central Andrews Pencil 75 1.99 149.25\n", "7 2016-05-05 Central Jardine Pencil 90 4.99 449.10\n", "10 2016-06-25 Central Morgan Pencil 90 4.99 449.10\n", "14 2016-09-01 Central Smith Desk 2 125.00 250.00\n", "16 2016-10-05 Central Morgan Binder 28 8.99 251.72\n", "19 2016-11-25 Central Kivell Pen Set 96 4.99 479.04\n", "20 2016-12-12 Central Smith Pencil 67 1.29 86.43\n", "22 2017-01-15 Central Gill Binder 46 8.99 413.54\n", "23 2017-02-01 Central Smith Binder 87 15.00 1305.00\n", "26 2017-03-24 Central Jardine Pen Set 50 4.99 249.50\n", "27 2017-04-10 Central Andrews Pencil 66 1.99 131.34\n", "29 2017-05-14 Central Gill Pencil 53 1.29 68.37\n", "30 2017-05-31 Central Gill Binder 80 8.99 719.20\n", "31 2017-06-17 Central Kivell Desk 5 125.00 625.00\n", "33 2017-07-21 Central Morgan Pen Set 55 12.49 686.95\n", "34 2017-08-07 Central Kivell Pen Set 42 23.95 1005.90\n", "36 2017-09-10 Central Gill Pencil 7 1.29 9.03\n", "39 2017-10-31 Central Andrews Pencil 14 1.29 18.06\n", "40 2017-11-17 Central Jardine Binder 11 4.99 54.89\n", "41 2017-12-04 Central Jardine Binder 94 19.99 1879.06\n", "42 2017-12-21 Central Andrews Binder 28 4.99 139.72" ] }, "execution_count": 7, "metadata": { }, "output_type": "execute_result" } ], "source": [ "df[df['Region']=='Central']" ] }, { "cell_type": "code", "execution_count": 11, "metadata": { "collapsed": false }, "outputs": [ { "name": "stderr", "output_type": "stream", "text": [ ":1: UserWarning: Boolean Series key will be reindexed to match DataFrame index.\n", " df_central_Binder= df_Central[df['Item']=='Binder']\n" ] } ], "source": [ "df_central_Binder= df_Central[df['Item']=='Binder']" ] }, { "cell_type": "code", "execution_count": 12, "metadata": { "collapsed": false }, "outputs": [ { "data": { "text/html": [ "
\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", "
OrderDateRegionRepItemUnitsUnit CostTotal
12016-01-23CentralKivellBinder5019.99999.50
162016-10-05CentralMorganBinder288.99251.72
222017-01-15CentralGillBinder468.99413.54
232017-02-01CentralSmithBinder8715.001305.00
302017-05-31CentralGillBinder808.99719.20
402017-11-17CentralJardineBinder114.9954.89
412017-12-04CentralJardineBinder9419.991879.06
422017-12-21CentralAndrewsBinder284.99139.72
\n", "
" ], "text/plain": [ " OrderDate Region Rep Item Units Unit Cost Total\n", "1 2016-01-23 Central Kivell Binder 50 19.99 999.50\n", "16 2016-10-05 Central Morgan Binder 28 8.99 251.72\n", "22 2017-01-15 Central Gill Binder 46 8.99 413.54\n", "23 2017-02-01 Central Smith Binder 87 15.00 1305.00\n", "30 2017-05-31 Central Gill Binder 80 8.99 719.20\n", "40 2017-11-17 Central Jardine Binder 11 4.99 54.89\n", "41 2017-12-04 Central Jardine Binder 94 19.99 1879.06\n", "42 2017-12-21 Central Andrews Binder 28 4.99 139.72" ] }, "execution_count": 12, "metadata": { }, "output_type": "execute_result" } ], "source": [ "df_central_Binder" ] }, { "cell_type": "code", "execution_count": 13, "metadata": { "collapsed": false }, "outputs": [ { "data": { "text/plain": [ "424" ] }, "execution_count": 13, "metadata": { }, "output_type": "execute_result" } ], "source": [ "df_central_Binder['Units'].sum()" ] }, { "cell_type": "code", "execution_count": 0, "metadata": { "collapsed": false }, "outputs": [ ], "source": [ ] } ], "metadata": { "kernelspec": { "display_name": "Python 3 (system-wide)", "language": "python", "metadata": { "cocalc": { "description": "Python 3 programming language", "priority": 100, "url": "https://www.python.org/" } }, "name": "python3", "resource_dir": "/ext/jupyter/kernels/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.8.5" } }, "nbformat": 4, "nbformat_minor": 4 }