Skip to content

Instantly share code, notes, and snippets.

@triestpa
Created June 7, 2016 13:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save triestpa/b939b78f9c6b37d82f91f72dc36b9185 to your computer and use it in GitHub Desktop.
Save triestpa/b939b78f9c6b37d82f91f72dc36b9185 to your computer and use it in GitHub Desktop.
Class Agg
Display the source blob
Display the rendered blob
Raw
{
"cells": [
{
"cell_type": "code",
"execution_count": 4,
"metadata": {
"collapsed": false,
"scrolled": true
},
"outputs": [
{
"data": {
"text/html": [
"<div>\n",
"<table border=\"1\" class=\"dataframe\">\n",
" <thead>\n",
" <tr style=\"text-align: right;\">\n",
" <th></th>\n",
" <th>survived</th>\n",
" <th>age</th>\n",
" <th>sibsp</th>\n",
" <th>parch</th>\n",
" <th>fare</th>\n",
" <th>body</th>\n",
" </tr>\n",
" <tr>\n",
" <th>pclass</th>\n",
" <th></th>\n",
" <th></th>\n",
" <th></th>\n",
" <th></th>\n",
" <th></th>\n",
" <th></th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>1</th>\n",
" <td>0.619195</td>\n",
" <td>39.159918</td>\n",
" <td>0.436533</td>\n",
" <td>0.365325</td>\n",
" <td>87.508992</td>\n",
" <td>162.828571</td>\n",
" </tr>\n",
" <tr>\n",
" <th>2</th>\n",
" <td>0.429603</td>\n",
" <td>29.506705</td>\n",
" <td>0.393502</td>\n",
" <td>0.368231</td>\n",
" <td>21.179196</td>\n",
" <td>167.387097</td>\n",
" </tr>\n",
" <tr>\n",
" <th>3</th>\n",
" <td>0.255289</td>\n",
" <td>24.816367</td>\n",
" <td>0.568406</td>\n",
" <td>0.400564</td>\n",
" <td>13.302889</td>\n",
" <td>155.818182</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"text/plain": [
" survived age sibsp parch fare body\n",
"pclass \n",
"1 0.619195 39.159918 0.436533 0.365325 87.508992 162.828571\n",
"2 0.429603 29.506705 0.393502 0.368231 21.179196 167.387097\n",
"3 0.255289 24.816367 0.568406 0.400564 13.302889 155.818182"
]
},
"execution_count": 4,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"titanic_df.groupby('pclass').mean()"
]
}
],
"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.4.2"
}
},
"nbformat": 4,
"nbformat_minor": 0
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment