ODO 6 Slice the 'area' column using either iloc, loc or square brackets [ ]. Store the output into the variable area_values. Plot area_values using the Matplotlib plt.hist() function. For the plt.hist() function all we have to do is pass area_values and it will automatically compute the bins our data (bins help to discretize continuous data by breaking the continuous data into discrete groups). Optionally, we could specify the bins. See the docs for more information. Call and print the value_counts() method from area_values to see how many data samples have values near 0. Store the output into the variable area_value_count. # TODO 6.1 area_values = display(area_values) todo_check([ (area_values.shape == (517,), 'area_values shape did not match (517,)'), (np.all(area_values.values[-10:] == np.array([ 0. , 0. , 2.17, 0.43, 0. , 6.44, 54.29, 11.16, 0. ,0. ])), 'area_values did not contain the correct values!') ]) # TODO 6.2 plt.show() # TODO 6.3 area_value_count = display(area_value_count) todo_check([ (area_value_count.shape == (251,), 'area_value_count shape did not match (251,)'), (np.all(area_value_count.values[:5] == np.array([247, 3, 2, 2, 2])), 'area_value_count values did not match!') ])

New Perspectives on HTML5, CSS3, and JavaScript
6th Edition
ISBN:9781305503922
Author:Patrick M. Carey
Publisher:Patrick M. Carey
Chapter9: Getting Started With Javascript: Creating A Countdown Clock
Section: Chapter Questions
Problem 10CP4
icon
Related questions
Question

TODO 6

  1. Slice the 'area' column using either iloc, loc or square brackets [ ]. Store the output into the variable area_values.

  2. Plot area_values using the Matplotlib plt.hist() function. For the plt.hist() function all we have to do is pass area_values and it will automatically compute the bins our data (bins help to discretize continuous data by breaking the continuous data into discrete groups). Optionally, we could specify the bins. See the docs for more information.

  3. Call and print the value_counts() method from area_values to see how many data samples have values near 0. Store the output into the variable area_value_count.

# TODO 6.1
area_values =
display(area_values)

todo_check([
    (area_values.shape == (517,), 'area_values shape did not match (517,)'),
    (np.all(area_values.values[-10:] == np.array([ 0.  ,  0.  ,  2.17,  0.43,  0.  ,  6.44, 54.29, 11.16,  0.  ,0.  ])), 'area_values did not contain the correct values!')
])

 

# TODO 6.2

plt.show()

 

# TODO 6.3
area_value_count = 
display(area_value_count)

todo_check([
    (area_value_count.shape == (251,), 'area_value_count shape did not match (251,)'),
    (np.all(area_value_count.values[:5] == np.array([247,   3,   2,   2,   2])), 'area_value_count values did not match!')
])

Expert Solution
Step 1

TODO 6 is a section in code that is responsible for creating a histogram of the "area" column of a DataFrame and counting the number of occurrences of each value in the "area" column.

The first step of TODO 6 is to slice the 'area' column from the DataFrame and store it into the variable "area_values".

The next step is to plot the histogram of the "area_values". This can be done using the Matplotlib plt.hist() function, where "area_values" is passed as the argument to the function.

The final step is to count the number of occurrences of each value in the "area_values" and store the result in the variable "area_value_count". This can be done using the value_counts() method from the "area_values" variable.

The output of the code should be:

  • A histogram of the "area_values"
  • A table showing the count of occurrences of each value in the "area_values".

Todo_check() is a function that checks if the expected outcome has been met, it will display an error message if the outcome does not match the expected result.

trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 4 steps with 1 images

Blurred answer
Knowledge Booster
Types of trees
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
New Perspectives on HTML5, CSS3, and JavaScript
New Perspectives on HTML5, CSS3, and JavaScript
Computer Science
ISBN:
9781305503922
Author:
Patrick M. Carey
Publisher:
Cengage Learning
COMPREHENSIVE MICROSOFT OFFICE 365 EXCE
COMPREHENSIVE MICROSOFT OFFICE 365 EXCE
Computer Science
ISBN:
9780357392676
Author:
FREUND, Steven
Publisher:
CENGAGE L
Np Ms Office 365/Excel 2016 I Ntermed
Np Ms Office 365/Excel 2016 I Ntermed
Computer Science
ISBN:
9781337508841
Author:
Carey
Publisher:
Cengage