Getting an Overview of the Column Types

This commit is contained in:
rasbt 2015-01-28 22:31:23 -05:00
parent db6679eb9c
commit 40d5dd93a5

View File

@ -1,7 +1,7 @@
{
"metadata": {
"name": "",
"signature": "sha256:3155cd3fa2449393a467f91f3cdbb32eeac212db664843ef30f96b635dbfc06d"
"signature": "sha256:2dd2df7144acb424c4be84b5679ebc4d06bf16dc6a3e0f7fd3d1ed0595479f64"
},
"nbformat": 3,
"nbformat_minor": 0,
@ -38,7 +38,7 @@
]
}
],
"prompt_number": 1
"prompt_number": 2
},
{
"cell_type": "markdown",
@ -98,7 +98,8 @@
"- [Appending Rows to a DataFrame](#Appending-Rows-to-a-DataFrame)\n",
"- [Sorting and Reindexing DataFrames](#Sorting-and-Reindexing-DataFrames)\n",
"- [Updating Columns](#Updating-Columns)\n",
"- [Chaining Conditions - Using Bitwise Operators](#Chaining-Conditions---Using-Bitwise-Operators)"
"- [Chaining Conditions - Using Bitwise Operators](#Chaining-Conditions---Using-Bitwise-Operators)\n",
"- [Getting an Overview of the Column Types](#Getting-an-Overview-of-the-Column-Types)"
]
},
{
@ -277,7 +278,7 @@
],
"metadata": {},
"output_type": "pyout",
"prompt_number": 2,
"prompt_number": 3,
"text": [
" PLAYER SALARY GP G A SOT \\\n",
"0 Sergio Ag\u00fcero\\n Forward \u2014 Manchester City $19.2m 16 14 3 34 \n",
@ -305,7 +306,7 @@
]
}
],
"prompt_number": 2
"prompt_number": 3
},
{
"cell_type": "markdown",
@ -419,7 +420,7 @@
],
"metadata": {},
"output_type": "pyout",
"prompt_number": 3,
"prompt_number": 4,
"text": [
" player salary gp g a sot ppg \\\n",
"7 Cesc F\u00e0bregas\\n Midfield \u2014 Chelsea $14.0m 20 2 14 10 10.47 \n",
@ -433,7 +434,7 @@
]
}
],
"prompt_number": 3
"prompt_number": 4
},
{
"cell_type": "markdown",
@ -524,7 +525,7 @@
],
"metadata": {},
"output_type": "pyout",
"prompt_number": 4,
"prompt_number": 5,
"text": [
" player salary games goals assists \\\n",
"7 Cesc F\u00e0bregas\\n Midfield \u2014 Chelsea $14.0m 20 2 14 \n",
@ -538,7 +539,7 @@
]
}
],
"prompt_number": 4
"prompt_number": 5
},
{
"cell_type": "markdown",
@ -670,7 +671,7 @@
],
"metadata": {},
"output_type": "pyout",
"prompt_number": 5,
"prompt_number": 6,
"text": [
" player salary games goals assists \\\n",
"5 Santiago Cazorla\\n Midfield \u2014 Arsenal 14.8 20 4 NaN \n",
@ -688,7 +689,7 @@
]
}
],
"prompt_number": 5
"prompt_number": 6
},
{
"cell_type": "markdown",
@ -785,7 +786,7 @@
],
"metadata": {},
"output_type": "pyout",
"prompt_number": 6,
"prompt_number": 7,
"text": [
" player salary games goals assists \\\n",
"7 Cesc F\u00e0bregas\\n Midfield \u2014 Chelsea 14.0 20 2 14 \n",
@ -799,7 +800,7 @@
]
}
],
"prompt_number": 6
"prompt_number": 7
},
{
"cell_type": "code",
@ -892,7 +893,7 @@
],
"metadata": {},
"output_type": "pyout",
"prompt_number": 7,
"prompt_number": 8,
"text": [
" player salary games goals assists shots_on_target \\\n",
"7 Cesc F\u00e0bregas 14.0 20 2 14 10 \n",
@ -906,7 +907,7 @@
]
}
],
"prompt_number": 7
"prompt_number": 8
},
{
"cell_type": "markdown",
@ -1026,7 +1027,7 @@
],
"metadata": {},
"output_type": "pyout",
"prompt_number": 8,
"prompt_number": 9,
"text": [
" player salary games goals assists shots_on_target \\\n",
"0 sergio ag\u00fcero 19.2 16 14 3 34 \n",
@ -1044,7 +1045,7 @@
]
}
],
"prompt_number": 8
"prompt_number": 9
},
{
"cell_type": "markdown",
@ -1104,7 +1105,7 @@
]
}
],
"prompt_number": 9
"prompt_number": 10
},
{
"cell_type": "markdown",
@ -1185,7 +1186,7 @@
],
"metadata": {},
"output_type": "pyout",
"prompt_number": 10,
"prompt_number": 11,
"text": [
" player salary games goals assists shots_on_target \\\n",
"4 \u00e1ngel di mar\u00eda 15.0 13 3 NaN 13 \n",
@ -1197,7 +1198,7 @@
]
}
],
"prompt_number": 10
"prompt_number": 11
},
{
"cell_type": "markdown",
@ -1354,7 +1355,7 @@
],
"metadata": {},
"output_type": "pyout",
"prompt_number": 11,
"prompt_number": 12,
"text": [
" player salary games goals assists shots_on_target \\\n",
"0 sergio ag\u00fcero 19.2 16 14 3 34 \n",
@ -1378,7 +1379,7 @@
]
}
],
"prompt_number": 11
"prompt_number": 12
},
{
"cell_type": "markdown",
@ -1564,7 +1565,7 @@
],
"metadata": {},
"output_type": "pyout",
"prompt_number": 12,
"prompt_number": 13,
"text": [
" player salary games goals assists shots_on_target \\\n",
"0 sergio ag\u00fcero 19.2 16 14 3 34 \n",
@ -1592,7 +1593,7 @@
]
}
],
"prompt_number": 12
"prompt_number": 13
},
{
"cell_type": "markdown",
@ -1700,7 +1701,7 @@
],
"metadata": {},
"output_type": "pyout",
"prompt_number": 13,
"prompt_number": 14,
"text": [
" player salary games goals assists shots_on_target \\\n",
"8 saido berahino 13.8 21 9 0 20 \n",
@ -1714,7 +1715,7 @@
]
}
],
"prompt_number": 13
"prompt_number": 14
},
{
"cell_type": "code",
@ -1794,7 +1795,7 @@
],
"metadata": {},
"output_type": "pyout",
"prompt_number": 14,
"prompt_number": 15,
"text": [
" player salary games goals assists shots_on_target \\\n",
"8 saido berahino 13.8 21 9 0 20 \n",
@ -1808,7 +1809,7 @@
]
}
],
"prompt_number": 14
"prompt_number": 15
},
{
"cell_type": "markdown",
@ -1936,7 +1937,7 @@
],
"metadata": {},
"output_type": "pyout",
"prompt_number": 15,
"prompt_number": 16,
"text": [
" player salary games goals assists shots_on_target \\\n",
"0 sergio ag\u00fcero 19.2 16 14 3 34 \n",
@ -1954,7 +1955,7 @@
]
}
],
"prompt_number": 15
"prompt_number": 16
},
{
"cell_type": "code",
@ -2059,7 +2060,7 @@
],
"metadata": {},
"output_type": "pyout",
"prompt_number": 16,
"prompt_number": 17,
"text": [
" player salary games goals assists shots_on_target \\\n",
"1 sergio ag\u00fcero 19.2 16 14 3 34 \n",
@ -2077,7 +2078,7 @@
]
}
],
"prompt_number": 16
"prompt_number": 17
},
{
"cell_type": "markdown",
@ -2180,7 +2181,7 @@
],
"metadata": {},
"output_type": "pyout",
"prompt_number": 17,
"prompt_number": 18,
"text": [
" player salary games goals assists shots_on_target \\\n",
"1 sergio ag\u00fcero 20 16 14 3 34 \n",
@ -2194,7 +2195,7 @@
]
}
],
"prompt_number": 17
"prompt_number": 18
},
{
"cell_type": "markdown",
@ -2291,7 +2292,7 @@
],
"metadata": {},
"output_type": "pyout",
"prompt_number": 18,
"prompt_number": 19,
"text": [
" salary games goals assists shots_on_target \\\n",
"player \n",
@ -2307,7 +2308,7 @@
]
}
],
"prompt_number": 18
"prompt_number": 19
},
{
"cell_type": "markdown",
@ -2401,7 +2402,7 @@
],
"metadata": {},
"output_type": "pyout",
"prompt_number": 19,
"prompt_number": 20,
"text": [
" salary games goals assists shots_on_target \\\n",
"player \n",
@ -2417,7 +2418,7 @@
]
}
],
"prompt_number": 19
"prompt_number": 20
},
{
"cell_type": "markdown",
@ -2503,7 +2504,7 @@
],
"metadata": {},
"output_type": "pyout",
"prompt_number": 20,
"prompt_number": 21,
"text": [
" player salary games goals assists shots_on_target \\\n",
"0 sergio ag\u00fcero 20 16 14 3 34 \n",
@ -2517,7 +2518,7 @@
]
}
],
"prompt_number": 20
"prompt_number": 21
},
{
"cell_type": "markdown",
@ -2631,7 +2632,7 @@
],
"metadata": {},
"output_type": "pyout",
"prompt_number": 21,
"prompt_number": 22,
"text": [
" player salary games goals assists shots_on_target \\\n",
"1 alexis s\u00e1nchez 15 0 12 7 29 \n",
@ -2647,7 +2648,7 @@
]
}
],
"prompt_number": 21
"prompt_number": 22
},
{
"cell_type": "code",
@ -2699,7 +2700,7 @@
],
"metadata": {},
"output_type": "pyout",
"prompt_number": 22,
"prompt_number": 23,
"text": [
" player salary games goals assists shots_on_target \\\n",
"1 alexis s\u00e1nchez 15 0 12 7 29 \n",
@ -2709,7 +2710,60 @@
]
}
],
"prompt_number": 22
"prompt_number": 23
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"<br>\n",
"<br>"
]
},
{
"cell_type": "heading",
"level": 1,
"metadata": {},
"source": [
"Getting an Overview of the Column Types"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"[[back to section overview](#Sections)]"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"types = df.columns.to_series().groupby(df.dtypes).groups\n",
"for t in types.items():\n",
" print(t)"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"(dtype('O'), ['player', 'salary', 'position', 'team'])\n",
"(dtype('float64'), ['games', 'goals', 'assists', 'shots_on_target', 'points_per_game', 'points'])\n"
]
}
],
"prompt_number": 29
},
{
"cell_type": "code",
"collapsed": false,
"input": [],
"language": "python",
"metadata": {},
"outputs": []
}
],
"metadata": {}