A new table with only those columns in it the columns

This preview shows page 12 - 16 out of 28 pages.

a new table with only those columns in it. The columns are in the order in which they were listed as arguments . For example, the value of farmers_markets.select("MarketName", "State") is a table with only the name and the state of each farmers' market in farmers_markets . Question 3.3. Use select to create a table with only the name, city, state, latitude ( y ), and longitude ( x ) of each market. Call that new table farmers_markets_locations . Hint: Make sure to be exact when using column names with select ; double-check capitalization! ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Running tests --------------------------------------------------------------------- Test summary Passed: 1 Failed: 0 [ooooooooook] 100.0% passed The table has 8546 rows in it!
1/27/2019 lab02_master 13/28 In [25]: farmers_markets_locations = farmers_markets.select("MarketName", "city", "State", "y", "x") #SOLUTION farmers_markets_locations In [26]: _ = ok.grade('q33') drop drop serves the same purpose as select , but it takes away the columns that you provide rather than the ones that you don't provide. Like select , drop returns a new table. Question 3.4. Suppose you just didn't want the FMID or updateTime columns in farmers_markets . Create a table that's a copy of farmers_markets but doesn't include those columns. Call that table farmers_markets_without_fmid . Out[25]: MarketName city State y x Caledonia Farmers Market Association - Danville Danville Vermont 44.411 -72.1403 Stearns Homestead Farmers' Market Parma Ohio 41.3751 -81.7286 100 Mile Market Kalamazoo Michigan 42.296 -85.5749 106 S. Main Street Farmers Market Six Mile South Carolina 34.8042 -82.8187 10th Steet Community Farmers Market Lamar Missouri 37.4956 -94.2746 112st Madison Avenue New York New York 40.7939 -73.9493 12 South Farmers Market Nashville Tennessee 36.1184 -86.7907 125th Street Fresh Connect Farmers' Market New York New York 40.809 -73.9482 12th & Brandywine Urban Farm Market Wilmington Delaware 39.7421 -75.5345 14&U Farmers' Market Washington District of Columbia 38.917 -77.0321 ... (8536 rows omitted) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Running tests --------------------------------------------------------------------- Test summary Passed: 1 Failed: 0 [ooooooooook] 100.0% passed
1/27/2019 lab02_master 14/28 In [27]: farmers_markets_without_fmid = farmers_markets.drop("FMID", "updateTime" ) #SOLUTION farmers_markets_without_fmid
1/27/2019 lab02_master 15/28 Out[27]: MarketName street city County State zip x y W Caledonia Farmers Market Association - Danville nan Danville Caledonia Vermont 05828 -72.1403 44.411 ht Stearns Homestead Farmers' Market 6975 Ridge Road Parma Cuyahoga Ohio 44130 -81.7286 41.3751 ht 100 Mile Market 507 Harrison St Kalamazoo Kalamazoo Michigan 49007 -85.5749 42.296 ht 106 S. Main Street Farmers Market 106 S. Main Street Six Mile nan South Carolina 29682 -82.8187 34.8042 ht 10th Steet Community Farmers Market 10th Street and Poplar Lamar Barton Missouri 64759 -94.2746 37.4956 na 112st Madison Avenue 112th Madison Avenue New York New York New York 10029 -73.9493 40.7939 na 12 South Farmers Market 3000 Granny White Pike Nashville Davidson Tennessee 37204 -86.7907 36.1184 ht 125th Street Fresh Connect Farmers' Market 163 West 125th Street and Adam Clayton Powell, Jr.

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture