Question: Please answer questions 4, 5, 6, 7, and 8 and provide the full code for each 4) (1 PT) Next, use a list comprehension to
Please answer questions 4, 5, 6, 7, and 8 and provide the full code for each

4) (1 PT) Next, use a list comprehension to return a filtered list containing only the values greater than 6. Call this list some_vals_filtered and print it. You can chain multiple commands on a single line like this: In [5]: x = 3; z = x + 1; z Out [5]: 4 In [ ]: Next, a small pandas dataframe is constructed. In [7]: import pandas as pd df = pd.DataFrame({'first_name': ['Andy', 'Crystal'], 'domain_facebook': [1,1], 'domain foursquare' : [0,0], 'age' : (20, 32] }) df Out [7] : first name domain_facebook domain_foursquare age 0 Andy 0 20 1 Crystal 0 32 5) (1 PT) In the cell below, write a list comprehension that returns the fields names in the dataframe df containing the string domain. Run the cell to verify the correct result. In (): 6) (1 PT) Use the list comprehension from (5) to index into df and show the data for columns containing domain In [ ]: 7) (1 PT) In the cell below, print the domain_facebook column In [ ]: 8) (1 PT) In the cell below, print the row with index 1. In [ ]
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
