{ "cells": [ { "cell_type": "code", "execution_count": 11, "metadata": { "collapsed": true }, "outputs": [], "source": [ "# HIDDEN\n", "from datascience import *\n", "import numpy as np\n", "np.set_printoptions(threshold=50)" ] }, { "cell_type": "code", "execution_count": 12, "metadata": { "collapsed": false }, "outputs": [], "source": [ "# HIDDEN\n", "nba_salaries = Table.read_table('nba_salaries.csv')\n", "nba = nba_salaries.relabeled(\"'15-'16 SALARY\", 'SALARY')" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Often, we would like to extract just those rows that correspond to entries with a particular feature. For example, we might want only the rows corresponding to the Warriors, or to players who earned more than $\\$10$ million. Or we might just want the top five earners." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### Specified Rows\n", "The Table method `take` does just that – it takes a specified set of rows. Its argument is a row index or array of indices, and it creates a new table consisting of only those rows.\n", "\n", "For example, if we wanted just the first row of `nba`, we could use `take` as follows." ] }, { "cell_type": "code", "execution_count": 13, "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", "
PLAYER POSITION TEAM SALARY
Paul Millsap PF Atlanta Hawks 18.6717
Al Horford C Atlanta Hawks 12
Tiago Splitter C Atlanta Hawks 9.75625
Jeff Teague PG Atlanta Hawks 8
Kyle Korver SG Atlanta Hawks 5.74648
Thabo Sefolosha SF Atlanta Hawks 4
Mike Scott PF Atlanta Hawks 3.33333
Kent Bazemore SF Atlanta Hawks 2
Dennis Schroder PG Atlanta Hawks 1.7634
Tim Hardaway Jr. SG Atlanta Hawks 1.30452
\n", "

... (407 rows omitted)\n", " \n", " \n", " PLAYER POSITION TEAM SALARY\n", " \n", " \n", " \n", " \n", " Paul Millsap PF Atlanta Hawks 18.6717\n", " \n", " \n", "" ], "text/plain": [ "PLAYER | POSITION | TEAM | SALARY\n", "Paul Millsap | PF | Atlanta Hawks | 18.6717" ] }, "execution_count": 14, "metadata": {}, "output_type": "execute_result" } ], "source": [ "nba.take(0)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "This is a new table with just the single row that we specified.\n", "\n", "We could also get the fourth, fifth, and sixth rows by specifying a range of indices as the argument." ] }, { "cell_type": "code", "execution_count": 15, "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", "
PLAYER POSITION TEAM SALARY
Jeff Teague PG Atlanta Hawks 8
Kyle Korver SG Atlanta Hawks 5.74648
Thabo Sefolosha SF Atlanta Hawks 4
" ], "text/plain": [ "PLAYER | POSITION | TEAM | SALARY\n", "Jeff Teague | PG | Atlanta Hawks | 8\n", "Kyle Korver | SG | Atlanta Hawks | 5.74648\n", "Thabo Sefolosha | SF | Atlanta Hawks | 4" ] }, "execution_count": 15, "metadata": {}, "output_type": "execute_result" } ], "source": [ "nba.take(np.arange(3, 6))" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "If we want a table of the top 5 highest paid players, we can first sort the list by salary and then `take` the first five rows:" ] }, { "cell_type": "code", "execution_count": 16, "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", "
PLAYER POSITION TEAM SALARY
Kobe Bryant SF Los Angeles Lakers 25
Joe Johnson SF Brooklyn Nets 24.8949
LeBron James SF Cleveland Cavaliers 22.9705
Carmelo Anthony SF New York Knicks 22.875
Dwight Howard C Houston Rockets 22.3594
" ], "text/plain": [ "PLAYER | POSITION | TEAM | SALARY\n", "Kobe Bryant | SF | Los Angeles Lakers | 25\n", "Joe Johnson | SF | Brooklyn Nets | 24.8949\n", "LeBron James | SF | Cleveland Cavaliers | 22.9705\n", "Carmelo Anthony | SF | New York Knicks | 22.875\n", "Dwight Howard | C | Houston Rockets | 22.3594" ] }, "execution_count": 16, "metadata": {}, "output_type": "execute_result" } ], "source": [ "nba.sort('SALARY', descending=True).take(np.arange(5))" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### Rows Corresponding to a Specified Feature\n", "More often, we will want to access data in a set of rows that have a certain feature, but whose indices we don't know ahead of time. For example, we might want data on all the players who made more than $\\$10$ million, but we don't want to spend time counting rows in the sorted table.\n", "\n", "The method `where` does the job for us. Its output is a table with the same columns as the original but only the rows *where* the feature occurs.\n", "\n", "The first argument of `where` is the label of the column that contains the information about whether or not a row has the feature we want. If the feature is \"made more than $\\$10$ million\", the column is `SALARY`.\n", "\n", "The second argument of `where` is a way of specifying the feature. A couple of examples will make the general method of specification easier to understand.\n", "\n", "In the first example, we extract the data for all those who earned more than $\\$10$ million." ] }, { "cell_type": "code", "execution_count": 17, "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", "
PLAYER POSITION TEAM SALARY
Paul Millsap PF Atlanta Hawks 18.6717
Al Horford C Atlanta Hawks 12
Joe Johnson SF Brooklyn Nets 24.8949
Thaddeus Young PF Brooklyn Nets 11.236
Al Jefferson C Charlotte Hornets 13.5
Nicolas Batum SG Charlotte Hornets 13.1253
Kemba Walker PG Charlotte Hornets 12
Derrick Rose PG Chicago Bulls 20.0931
Jimmy Butler SG Chicago Bulls 16.4075
Joakim Noah C Chicago Bulls 13.4
\n", "

... (59 rows omitted)\n", " \n", " \n", " PLAYER POSITION TEAM SALARY\n", " \n", " \n", " \n", " \n", " DeMar DeRozan SG Toronto Raptors 10.05 \n", " \n", " \n", " \n", " Gerald Wallace SF Philadelphia 76ers 10.1059\n", " \n", " \n", " \n", " Luol Deng SF Miami Heat 10.1516\n", " \n", " \n", " \n", " Monta Ellis SG Indiana Pacers 10.3 \n", " \n", " \n", " \n", " Wilson Chandler SF Denver Nuggets 10.4494\n", " \n", " \n", " \n", " Brendan Haywood C Cleveland Cavaliers 10.5225\n", " \n", " \n", " \n", " Jrue Holiday PG New Orleans Pelicans 10.5955\n", " \n", " \n", " \n", " Tyreke Evans SG New Orleans Pelicans 10.7346\n", " \n", " \n", " \n", " Marcin Gortat C Washington Wizards 11.2174\n", " \n", " \n", " \n", " Thaddeus Young PF Brooklyn Nets 11.236 \n", " \n", " \n", "\n", "

... (59 rows omitted)\n", " \n", " \n", " PLAYER POSITION TEAM SALARY\n", " \n", " \n", " \n", " \n", " Stephen Curry PG Golden State Warriors 11.3708\n", " \n", " \n", "" ], "text/plain": [ "PLAYER | POSITION | TEAM | SALARY\n", "Stephen Curry | PG | Golden State Warriors | 11.3708" ] }, "execution_count": 19, "metadata": {}, "output_type": "execute_result" } ], "source": [ "nba.where('PLAYER', are.equal_to('Stephen Curry'))" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Curry made just under $\\$11.4$ million dollars. That's a lot of money, but it's less than half the salary of LeBron James. You'll find that salary in the \"Top 5\" table earlier in this section, or you could find it replacing `'Stephen Curry'` by `'LeBron James'` in the line of code above.\n", "\n", "In the code, `are` is used again, but this time with the *predicate* `equal_to` instead of `above`. Thus for example you can get a table of all the Warriors:" ] }, { "cell_type": "code", "execution_count": 20, "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", "
PLAYER POSITION TEAM SALARY
Klay Thompson SG Golden State Warriors 15.501
Draymond Green PF Golden State Warriors 14.2609
Andrew Bogut C Golden State Warriors 13.8
Andre Iguodala SF Golden State Warriors 11.7105
Stephen Curry PG Golden State Warriors 11.3708
Jason Thompson PF Golden State Warriors 7.00847
Shaun Livingston PG Golden State Warriors 5.54373
Harrison Barnes SF Golden State Warriors 3.8734
Marreese Speights C Golden State Warriors 3.815
Leandro Barbosa SG Golden State Warriors 2.5
Festus Ezeli C Golden State Warriors 2.00875
Brandon Rush SF Golden State Warriors 1.27096
Kevon Looney SF Golden State Warriors 1.13196
Anderson Varejao PF Golden State Warriors 0.289755
" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "nba.where('TEAM', are.equal_to('Golden State Warriors')).show()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "This portion of the table is already sorted by salary, because the original table listed players sorted by salary within the same team. The `.show()` at the end of the line ensures that all rows are shown, not just the first 10.\n", "\n", "It is so common to ask for the rows for which some column is equal to some value that the `are.equal_to` call is optional. Instead, the `where` method can be called with only a column name and a value to achieve the same effect." ] }, { "cell_type": "code", "execution_count": 21, "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", "
PLAYER POSITION TEAM SALARY
Danilo Gallinari SF Denver Nuggets 14
Kenneth Faried PF Denver Nuggets 11.236
Wilson Chandler SF Denver Nuggets 10.4494
JJ Hickson C Denver Nuggets 5.6135
Jameer Nelson PG Denver Nuggets 4.345
Will Barton SF Denver Nuggets 3.53333
Emmanuel Mudiay PG Denver Nuggets 3.10224
Darrell Arthur PF Denver Nuggets 2.814
Jusuf Nurkic C Denver Nuggets 1.842
Joffrey Lauvergne C Denver Nuggets 1.70972
\n", "

... (4 rows omitted)\n", " \n", " \n", " PLAYER POSITION TEAM SALARY\n", " \n", " \n", " \n", " \n", " Derrick Rose PG Chicago Bulls 20.0931\n", " \n", " \n", " \n", " Kyrie Irving PG Cleveland Cavaliers 16.4075\n", " \n", " \n", " \n", " Chris Paul PG Los Angeles Clippers 21.4687\n", " \n", " \n", " \n", " Russell Westbrook PG Oklahoma City Thunder 16.7442\n", " \n", " \n", " \n", " John Wall PG Washington Wizards 15.852 \n", " \n", " \n", "" ], "text/plain": [ "PLAYER | POSITION | TEAM | SALARY\n", "Derrick Rose | PG | Chicago Bulls | 20.0931\n", "Kyrie Irving | PG | Cleveland Cavaliers | 16.4075\n", "Chris Paul | PG | Los Angeles Clippers | 21.4687\n", "Russell Westbrook | PG | Oklahoma City Thunder | 16.7442\n", "John Wall | PG | Washington Wizards | 15.852" ] }, "execution_count": 22, "metadata": {}, "output_type": "execute_result" } ], "source": [ "nba.where('POSITION', 'PG').where('SALARY', are.above(15))" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### General Form ###\n", "By now you will have realized that the general way to create a new table by selecting rows with a given feature is to use `where` and `are` with the appropriate condition:\n", "\n", "`original_table_name.where(column_label_string, are.condition)`" ] }, { "cell_type": "code", "execution_count": 23, "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", "
PLAYER POSITION TEAM SALARY
Luol Deng SF Miami Heat 10.1516
Gerald Wallace SF Philadelphia 76ers 10.1059
Danny Green SG San Antonio Spurs 10
DeMar DeRozan SG Toronto Raptors 10.05
" ], "text/plain": [ "PLAYER | POSITION | TEAM | SALARY\n", "Luol Deng | SF | Miami Heat | 10.1516\n", "Gerald Wallace | SF | Philadelphia 76ers | 10.1059\n", "Danny Green | SG | San Antonio Spurs | 10\n", "DeMar DeRozan | SG | Toronto Raptors | 10.05" ] }, "execution_count": 23, "metadata": {}, "output_type": "execute_result" } ], "source": [ "nba.where('SALARY', are.between(10, 10.3))" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Notice that the table above includes Danny Green who made $\\$10$ million, but *not* Monta Ellis who made $\\$10.3$ million. As elsewhere in Python, the range `between` includes the left end but not the right." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "If we specify a condition that isn't satisfied by any row, we get a table with column labels but no rows." ] }, { "cell_type": "code", "execution_count": 24, "metadata": { "collapsed": false }, "outputs": [ { "data": { "text/html": [ "\n", " \n", " \n", " \n", " \n", " \n", " \n", "
PLAYER POSITION TEAM SALARY
" ], "text/plain": [ "PLAYER | POSITION | TEAM | SALARY" ] }, "execution_count": 24, "metadata": {}, "output_type": "execute_result" } ], "source": [ "nba.where('PLAYER', are.equal_to('Barack Obama'))" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### Some More Conditions ###\n", "Here are some predicates of `are` that you might find useful. Note that `x` and `y` are numbers, `STRING` is a string, and `Z` is either a number or a string; you have to specify these depending on the feature you want.\n", "\n", "| **Predicate** | Description |\n", "|----------------------------|------------------------------------------|\n", "| `are.equal_to(Z)` | Equal to `Z` | \n", "| `are.above(x)` | Greater than `x` |\n", "| `are.above_or_equal_to(x)` | Greater than or equal to `x` |\n", "| `are.below(x)` | Less than `x` |\n", "| `are.below_or_equal_to(x)` | Less than or equal to `x` |\n", "| `are.between(x, y)` | Greater than or equal to `x`, and less than `y` |\n", "| `are.strictly_between(x, y)` | Greater than `x` and less than `y` |\n", "| `are.between_or_equal_to(x, y)` | Greater than or equal to `x`, and less than or equal to `y` |\n", "| `are.containing(S)` | Contains the string `S` | " ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "You can also specify the negation of any of these conditions, by using `.not_` before the condition:\n", "\n", "| **Predicate** | Description |\n", "|----------------------------|------------------------------------------|\n", "| `are.not_equal_to(Z)` | Not equal to `Z` | \n", "| `are.not_above(x)` | Not above `x` |" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "... and so on. The usual rules of logic apply – for example, \"not above x\" is the same as \"below or equal to x\"." ] }, { "cell_type": "markdown", "metadata": { "collapsed": true }, "source": [ "We end the section with a series of examples. " ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "The use of `are.containing` can help save some typing. For example, you can just specify `Warriors` instead of `Golden State Warriors`:" ] }, { "cell_type": "code", "execution_count": 25, "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", "
PLAYER POSITION TEAM SALARY
Klay Thompson SG Golden State Warriors 15.501
Draymond Green PF Golden State Warriors 14.2609
Andrew Bogut C Golden State Warriors 13.8
Andre Iguodala SF Golden State Warriors 11.7105
Stephen Curry PG Golden State Warriors 11.3708
Jason Thompson PF Golden State Warriors 7.00847
Shaun Livingston PG Golden State Warriors 5.54373
Harrison Barnes SF Golden State Warriors 3.8734
Marreese Speights C Golden State Warriors 3.815
Leandro Barbosa SG Golden State Warriors 2.5
Festus Ezeli C Golden State Warriors 2.00875
Brandon Rush SF Golden State Warriors 1.27096
Kevon Looney SF Golden State Warriors 1.13196
Anderson Varejao PF Golden State Warriors 0.289755
" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "nba.where('TEAM', are.containing('Warriors')).show()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "You can extract data for all the guards, both Point Guards and Shooting Guards:" ] }, { "cell_type": "code", "execution_count": 26, "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", "
PLAYER POSITION TEAM SALARY
Jeff Teague PG Atlanta Hawks 8
Kyle Korver SG Atlanta Hawks 5.74648
Dennis Schroder PG Atlanta Hawks 1.7634
Tim Hardaway Jr. SG Atlanta Hawks 1.30452
Jason Richardson SG Atlanta Hawks 0.947276
Lamar Patterson SG Atlanta Hawks 0.525093
Terran Petteway SG Atlanta Hawks 0.525093
Avery Bradley PG Boston Celtics 7.73034
Isaiah Thomas PG Boston Celtics 6.91287
Marcus Smart PG Boston Celtics 3.43104
\n", "

... (171 rows omitted)\n", " \n", " \n", " PLAYER POSITION TEAM SALARY\n", " \n", " \n", " \n", " \n", " Joe Johnson SF Brooklyn Nets 24.8949\n", " \n", " \n", " \n", " Derrick Rose PG Chicago Bulls 20.0931\n", " \n", " \n", " \n", " Dwight Howard C Houston Rockets 22.3594\n", " \n", " \n", " \n", " Chris Paul PG Los Angeles Clippers 21.4687\n", " \n", " \n", " \n", " Kobe Bryant SF Los Angeles Lakers 25 \n", " \n", " \n", " \n", " Chris Bosh PF Miami Heat 22.1927\n", " \n", " \n", " \n", " Dwyane Wade SG Miami Heat 20 \n", " \n", " \n", " \n", " Carmelo Anthony SF New York Knicks 22.875 \n", " \n", " \n", " \n", " Kevin Durant SF Oklahoma City Thunder 20.1586\n", " \n", " \n", "" ], "text/plain": [ "PLAYER | POSITION | TEAM | SALARY\n", "Joe Johnson | SF | Brooklyn Nets | 24.8949\n", "Derrick Rose | PG | Chicago Bulls | 20.0931\n", "Dwight Howard | C | Houston Rockets | 22.3594\n", "Chris Paul | PG | Los Angeles Clippers | 21.4687\n", "Kobe Bryant | SF | Los Angeles Lakers | 25\n", "Chris Bosh | PF | Miami Heat | 22.1927\n", "Dwyane Wade | SG | Miami Heat | 20\n", "Carmelo Anthony | SF | New York Knicks | 22.875\n", "Kevin Durant | SF | Oklahoma City Thunder | 20.1586" ] }, "execution_count": 27, "metadata": {}, "output_type": "execute_result" } ], "source": [ "other_than_Cavs = nba.where('TEAM', are.not_equal_to('Cleveland Cavaliers'))\n", "other_than_Cavs.where('SALARY', are.not_below(20))" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "The same table can be created in many ways. Here is another, and no doubt you can think of more." ] }, { "cell_type": "code", "execution_count": 28, "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", "
PLAYER POSITION TEAM SALARY
Joe Johnson SF Brooklyn Nets 24.8949
Derrick Rose PG Chicago Bulls 20.0931
Dwight Howard C Houston Rockets 22.3594
Chris Paul PG Los Angeles Clippers 21.4687
Kobe Bryant SF Los Angeles Lakers 25
Chris Bosh PF Miami Heat 22.1927
Dwyane Wade SG Miami Heat 20
Carmelo Anthony SF New York Knicks 22.875
Kevin Durant SF Oklahoma City Thunder 20.1586
" ], "text/plain": [ "PLAYER | POSITION | TEAM | SALARY\n", "Joe Johnson | SF | Brooklyn Nets | 24.8949\n", "Derrick Rose | PG | Chicago Bulls | 20.0931\n", "Dwight Howard | C | Houston Rockets | 22.3594\n", "Chris Paul | PG | Los Angeles Clippers | 21.4687\n", "Kobe Bryant | SF | Los Angeles Lakers | 25\n", "Chris Bosh | PF | Miami Heat | 22.1927\n", "Dwyane Wade | SG | Miami Heat | 20\n", "Carmelo Anthony | SF | New York Knicks | 22.875\n", "Kevin Durant | SF | Oklahoma City Thunder | 20.1586" ] }, "execution_count": 28, "metadata": {}, "output_type": "execute_result" } ], "source": [ "other_than_Cavs.where('SALARY', are.above_or_equal_to(20))" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "As you can see, the use of `where` with `are` gives you great flexibility in accessing rows with features that interest you. Don't hesitate to experiment!" ] } ], "metadata": { "anaconda-cloud": {}, "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.5.2" } }, "nbformat": 4, "nbformat_minor": 0 }