Python Forum

Full Version: Joining two tables together
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
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.