Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Joining two tables together
#1
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.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Joining two jupyter notebooks and getting an error! Led_Zeppelin 1 1,147 Oct-20-2022, 04:28 PM
Last Post: deanhystad
  What is the value after JOINING an empty list? JaneTan 2 5,236 Jan-04-2021, 06:25 PM
Last Post: deanhystad
  Python - joining xmls together invalid token error jan86 0 2,220 Apr-26-2019, 08:52 AM
Last Post: jan86
  Joining a Daemon Thread QueenSvetlana 3 3,596 Nov-21-2017, 11:39 PM
Last Post: Windspar
  joining a variable number of lists in a comprehension Skaperen 2 2,823 Oct-14-2017, 08:19 AM
Last Post: Skaperen
  Joining results acmichelman 5 3,937 Sep-11-2017, 09:03 PM
Last Post: nilamo

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020