diff --git a/pandas/pandas.ipynb b/pandas/pandas.ipynb
index 6c8c4fd..f8f9780 100644
--- a/pandas/pandas.ipynb
+++ b/pandas/pandas.ipynb
@@ -4826,6 +4826,306 @@
}
],
"prompt_number": 94
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "DataFrames can rank over rows or columns."
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "df_13 = DataFrame({'foo' : [7, -5, 7, 4, 2, 0, 4, 7],\n",
+ " 'bar' : [-5, 4, 2, 0, 4, 7, 7, 8],\n",
+ " 'baz' : [-1, 2, 3, 0, 5, 9, 9, 5]})\n",
+ "df_13"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "html": [
+ "
\n",
+ "
\n",
+ " \n",
+ " \n",
+ " | \n",
+ " bar | \n",
+ " baz | \n",
+ " foo | \n",
+ "
\n",
+ " \n",
+ " \n",
+ " \n",
+ " 0 | \n",
+ " -5 | \n",
+ " -1 | \n",
+ " 7 | \n",
+ "
\n",
+ " \n",
+ " 1 | \n",
+ " 4 | \n",
+ " 2 | \n",
+ " -5 | \n",
+ "
\n",
+ " \n",
+ " 2 | \n",
+ " 2 | \n",
+ " 3 | \n",
+ " 7 | \n",
+ "
\n",
+ " \n",
+ " 3 | \n",
+ " 0 | \n",
+ " 0 | \n",
+ " 4 | \n",
+ "
\n",
+ " \n",
+ " 4 | \n",
+ " 4 | \n",
+ " 5 | \n",
+ " 2 | \n",
+ "
\n",
+ " \n",
+ " 5 | \n",
+ " 7 | \n",
+ " 9 | \n",
+ " 0 | \n",
+ "
\n",
+ " \n",
+ " 6 | \n",
+ " 7 | \n",
+ " 9 | \n",
+ " 4 | \n",
+ "
\n",
+ " \n",
+ " 7 | \n",
+ " 8 | \n",
+ " 5 | \n",
+ " 7 | \n",
+ "
\n",
+ " \n",
+ "
\n",
+ "
"
+ ],
+ "metadata": {},
+ "output_type": "pyout",
+ "prompt_number": 95,
+ "text": [
+ " bar baz foo\n",
+ "0 -5 -1 7\n",
+ "1 4 2 -5\n",
+ "2 2 3 7\n",
+ "3 0 0 4\n",
+ "4 4 5 2\n",
+ "5 7 9 0\n",
+ "6 7 9 4\n",
+ "7 8 5 7"
+ ]
+ }
+ ],
+ "prompt_number": 95
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "Rank a DataFrame over rows:"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "df_13.rank()"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "html": [
+ "\n",
+ "
\n",
+ " \n",
+ " \n",
+ " | \n",
+ " bar | \n",
+ " baz | \n",
+ " foo | \n",
+ "
\n",
+ " \n",
+ " \n",
+ " \n",
+ " 0 | \n",
+ " 1.0 | \n",
+ " 1.0 | \n",
+ " 7.0 | \n",
+ "
\n",
+ " \n",
+ " 1 | \n",
+ " 4.5 | \n",
+ " 3.0 | \n",
+ " 1.0 | \n",
+ "
\n",
+ " \n",
+ " 2 | \n",
+ " 3.0 | \n",
+ " 4.0 | \n",
+ " 7.0 | \n",
+ "
\n",
+ " \n",
+ " 3 | \n",
+ " 2.0 | \n",
+ " 2.0 | \n",
+ " 4.5 | \n",
+ "
\n",
+ " \n",
+ " 4 | \n",
+ " 4.5 | \n",
+ " 5.5 | \n",
+ " 3.0 | \n",
+ "
\n",
+ " \n",
+ " 5 | \n",
+ " 6.5 | \n",
+ " 7.5 | \n",
+ " 2.0 | \n",
+ "
\n",
+ " \n",
+ " 6 | \n",
+ " 6.5 | \n",
+ " 7.5 | \n",
+ " 4.5 | \n",
+ "
\n",
+ " \n",
+ " 7 | \n",
+ " 8.0 | \n",
+ " 5.5 | \n",
+ " 7.0 | \n",
+ "
\n",
+ " \n",
+ "
\n",
+ "
"
+ ],
+ "metadata": {},
+ "output_type": "pyout",
+ "prompt_number": 96,
+ "text": [
+ " bar baz foo\n",
+ "0 1.0 1.0 7.0\n",
+ "1 4.5 3.0 1.0\n",
+ "2 3.0 4.0 7.0\n",
+ "3 2.0 2.0 4.5\n",
+ "4 4.5 5.5 3.0\n",
+ "5 6.5 7.5 2.0\n",
+ "6 6.5 7.5 4.5\n",
+ "7 8.0 5.5 7.0"
+ ]
+ }
+ ],
+ "prompt_number": 96
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "Rank a DataFrame over columns:"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "df_13.rank(axis=1)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "html": [
+ "\n",
+ "
\n",
+ " \n",
+ " \n",
+ " | \n",
+ " bar | \n",
+ " baz | \n",
+ " foo | \n",
+ "
\n",
+ " \n",
+ " \n",
+ " \n",
+ " 0 | \n",
+ " 1.0 | \n",
+ " 2.0 | \n",
+ " 3 | \n",
+ "
\n",
+ " \n",
+ " 1 | \n",
+ " 3.0 | \n",
+ " 2.0 | \n",
+ " 1 | \n",
+ "
\n",
+ " \n",
+ " 2 | \n",
+ " 1.0 | \n",
+ " 2.0 | \n",
+ " 3 | \n",
+ "
\n",
+ " \n",
+ " 3 | \n",
+ " 1.5 | \n",
+ " 1.5 | \n",
+ " 3 | \n",
+ "
\n",
+ " \n",
+ " 4 | \n",
+ " 2.0 | \n",
+ " 3.0 | \n",
+ " 1 | \n",
+ "
\n",
+ " \n",
+ " 5 | \n",
+ " 2.0 | \n",
+ " 3.0 | \n",
+ " 1 | \n",
+ "
\n",
+ " \n",
+ " 6 | \n",
+ " 2.0 | \n",
+ " 3.0 | \n",
+ " 1 | \n",
+ "
\n",
+ " \n",
+ " 7 | \n",
+ " 3.0 | \n",
+ " 1.0 | \n",
+ " 2 | \n",
+ "
\n",
+ " \n",
+ "
\n",
+ "
"
+ ],
+ "metadata": {},
+ "output_type": "pyout",
+ "prompt_number": 97,
+ "text": [
+ " bar baz foo\n",
+ "0 1.0 2.0 3\n",
+ "1 3.0 2.0 1\n",
+ "2 1.0 2.0 3\n",
+ "3 1.5 1.5 3\n",
+ "4 2.0 3.0 1\n",
+ "5 2.0 3.0 1\n",
+ "6 2.0 3.0 1\n",
+ "7 3.0 1.0 2"
+ ]
+ }
+ ],
+ "prompt_number": 97
}
],
"metadata": {}