Jul-22-2018, 11:29 AM
Hi everyone,
I did the following:
# The next lines are provided for you. They create a table
# containing only the Alaska information and one containing
# only the Minnesota information.
ak = murder_rates.where('State', 'Alaska').drop('State', 'Population').relabeled(1, 'Murder rate in Alaska')
mn = murder_rates.where('State', 'Minnesota').drop('State', 'Population').relabeled(1, 'Murder rate in Minnesota')
# Fill in this line to make a table like the one pictured above.
ak_mn = Table().with_column("Year", ak.column(0), "Murder rate in Alaska", ak.column(1), "Murder rate in Minnesota", mn.column(1))
ak_mn
Is there an easier / better way to do it? I'm not sure if the highlighted part above is the best way to solve this.
I did the following:
# The next lines are provided for you. They create a table
# containing only the Alaska information and one containing
# only the Minnesota information.
ak = murder_rates.where('State', 'Alaska').drop('State', 'Population').relabeled(1, 'Murder rate in Alaska')
mn = murder_rates.where('State', 'Minnesota').drop('State', 'Population').relabeled(1, 'Murder rate in Minnesota')
# Fill in this line to make a table like the one pictured above.
ak_mn = Table().with_column("Year", ak.column(0), "Murder rate in Alaska", ak.column(1), "Murder rate in Minnesota", mn.column(1))
ak_mn
Is there an easier / better way to do it? I'm not sure if the highlighted part above is the best way to solve this.