Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,19 @@
"data": {
"text/html": [
"<div>\n",
"<style scoped>\n",
" .dataframe tbody tr th:only-of-type {\n",
" vertical-align: middle;\n",
" }\n",
"\n",
" .dataframe tbody tr th {\n",
" vertical-align: top;\n",
" }\n",
"\n",
" .dataframe thead th {\n",
" text-align: right;\n",
" }\n",
"</style>\n",
"<table border=\"1\" class=\"dataframe\">\n",
" <thead>\n",
" <tr style=\"text-align: right;\">\n",
Expand Down Expand Up @@ -253,13 +266,15 @@
"<class 'pandas.core.frame.DataFrame'>\n",
"RangeIndex: 4622 entries, 0 to 4621\n",
"Data columns (total 5 columns):\n",
"order_id 4622 non-null int64\n",
"quantity 4622 non-null int64\n",
"item_name 4622 non-null object\n",
"choice_description 3376 non-null object\n",
"item_price 4622 non-null object\n",
" # Column Non-Null Count Dtype \n",
"--- ------ -------------- ----- \n",
" 0 order_id 4622 non-null int64 \n",
" 1 quantity 4622 non-null int64 \n",
" 2 item_name 4622 non-null object\n",
" 3 choice_description 3376 non-null object\n",
" 4 item_price 4622 non-null object\n",
"dtypes: int64(2), object(3)\n",
"memory usage: 180.6+ KB\n"
"memory usage: 180.7+ KB\n"
]
}
],
Expand Down Expand Up @@ -315,8 +330,8 @@
{
"data": {
"text/plain": [
"Index([u'order_id', u'quantity', u'item_name', u'choice_description',\n",
" u'item_price'],\n",
"Index(['order_id', 'quantity', 'item_name', 'choice_description',\n",
" 'item_price'],\n",
" dtype='object')"
]
},
Expand Down Expand Up @@ -376,33 +391,43 @@
"data": {
"text/html": [
"<div>\n",
"<style scoped>\n",
" .dataframe tbody tr th:only-of-type {\n",
" vertical-align: middle;\n",
" }\n",
"\n",
" .dataframe tbody tr th {\n",
" vertical-align: top;\n",
" }\n",
"\n",
" .dataframe thead th {\n",
" text-align: right;\n",
" }\n",
"</style>\n",
"<table border=\"1\" class=\"dataframe\">\n",
" <thead>\n",
" <tr style=\"text-align: right;\">\n",
" <th></th>\n",
" <th>order_id</th>\n",
" <th>quantity</th>\n",
" </tr>\n",
" <tr>\n",
" <th>item_name</th>\n",
" <th></th>\n",
" <th></th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>Chicken Bowl</th>\n",
" <td>713926</td>\n",
" <td>761</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"text/plain": [
" order_id quantity\n",
"item_name \n",
"Chicken Bowl 713926 761"
" quantity\n",
"item_name \n",
"Chicken Bowl 761"
]
},
"execution_count": 9,
Expand All @@ -411,7 +436,7 @@
}
],
"source": [
"c = chipo.groupby('item_name')\n",
"c = chipo[['item_name','quantity']].groupby('item_name')\n",
"c = c.sum()\n",
"c = c.sort_values(['quantity'], ascending=False)\n",
"c.head(1)"
Expand All @@ -435,33 +460,43 @@
"data": {
"text/html": [
"<div>\n",
"<style scoped>\n",
" .dataframe tbody tr th:only-of-type {\n",
" vertical-align: middle;\n",
" }\n",
"\n",
" .dataframe tbody tr th {\n",
" vertical-align: top;\n",
" }\n",
"\n",
" .dataframe thead th {\n",
" text-align: right;\n",
" }\n",
"</style>\n",
"<table border=\"1\" class=\"dataframe\">\n",
" <thead>\n",
" <tr style=\"text-align: right;\">\n",
" <th></th>\n",
" <th>order_id</th>\n",
" <th>quantity</th>\n",
" </tr>\n",
" <tr>\n",
" <th>item_name</th>\n",
" <th></th>\n",
" <th></th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>Chicken Bowl</th>\n",
" <td>713926</td>\n",
" <td>761</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"text/plain": [
" order_id quantity\n",
"item_name \n",
"Chicken Bowl 713926 761"
" quantity\n",
"item_name \n",
"Chicken Bowl 761"
]
},
"execution_count": 10,
Expand All @@ -470,7 +505,7 @@
}
],
"source": [
"c = chipo.groupby('item_name')\n",
"c = chipo[['item_name','quantity']].groupby('item_name')\n",
"c = c.sum()\n",
"c = c.sort_values(['quantity'], ascending=False)\n",
"c.head(1)"
Expand Down Expand Up @@ -797,21 +832,21 @@
"metadata": {
"anaconda-cloud": {},
"kernelspec": {
"display_name": "Python [default]",
"display_name": "mo_aval",
"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.12.4"
}
},
"nbformat": 4,
Expand Down