Question: # 1 2 . ( * Code ) ic _ long = ic _ wide.melt ( id _ vars = [ ' ID ' ,
# Code iclong icwide.meltidvarsID'address'valuename'count',varname'day'
iclong
# Write the code to create a heatmap or copypaste from item
# Instead of using dataicwide, make data be the line of code from item
# We can use this temporary copy of a dataframe instead of saving it as another
# dataframe.
# Your answer:
# Response
# Uhoh Why is this heat map useless? look carefully at the xaxis and color
# scale; compare to the dataframe
# I.e why are all the blocks on the days of the week the same color? Please be
# as specific as possible.
# Your answer:
# We can string together these two commands by putting the drop" command
# followed by the setindex" command. Run this code.
# We'll save it as a DataFrame for clarity.
icreformatted icwide.dropcolumns'address'setindexID
icreformatted
# Code
# Use the icreformatted to create a heat map.
# Title and label as needed.
# Your answer:
# Code and Response
# From the heat map, we can see that one ice cream shop is in a business district
# where people do not spend time on the weekend. Let's practice filtering rows
# by filtering out the data.
# Use the original dataframe icwide for this part.
# aResponse What is the ID number of this ice cream shop?
# bCode Use logical indexing to print True for the row with that shop and False for the others.
# cCode We want to get rid of that row. We therefore want to flip this to get False for
# that row and True for the others. Use negation in the logical indexing to produce
# the opposite result of part b
# dCode Use row selection combined with your answer to part c to print all the rows that
# are not that row.
# eCode Save your answer from part d into a dataframe called ic
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
