The join
method in the datascience module is not the join
string method.
def state(state1, state2):
state1_table = murder_rates.where('State', state1).drop('State', 'Population').relabeled(1, 'Murder rate in {}'.format(state1))
state2_table = murder_rates.where('State', state2).drop('State', 'Population').relabeled(1, 'Murder rate in {}'.format(state2))
s1_s2 = state1.join('Year', state2, 'Year')
state('California', 'New York')
Occasionally you may see the following error when trying to join
two tables with a common column name.
TypeError: join() takes exactly one argument (3 given)
However, if you run help(table1.join)
, suddenly you see some unexpected advice:
Help on built-in function join:
join(...) method of numpy.str_ instance
S.join(iterable) -> str
Return a string which is the concatenation of the strings in the
iterable. The separator between elements is S.
If this happens again, check the table name you're running join on. Very likely you're running the method on the wrong scalar value. Make sure the object is actually a table object. You're welcome, future me.