'Difference between calling columns of a dataframe in Python

I am trying to add a column of a dataframe to itself by calling the column using the . method. However Python gives me an error which I don't understand. This is the code:

In [29]:
gdp_pop.head()
Out[29]:

        date    country         gdp  series_code_x       pop series_code_y
0 1990-01-01  Australia  158051.132  NYGDPMKTPSAKD  17065100   SP.POP.TOTL
1 1990-04-01  Australia  158263.582  NYGDPMKTPSAKD  17065100   SP.POP.TOTL
2 1990-07-01  Australia  157329.279  NYGDPMKTPSAKD  17065100   SP.POP.TOTL
3 1990-09-01  Australia  158240.678  NYGDPMKTPSAKD  17065100   SP.POP.TOTL
4 1991-01-01  Australia  156195.954  NYGDPMKTPSAKD  17284000   SP.POP.TOTL

In [30]:
gdp_pop.dtypes['pop']
Out[30]:
dtype('int64')

In [31]:
gdp_pop.pop + gdp_pop.pop
Traceback (most recent call last):
  File "<stdin>", line 72, in exceptionCatcher
    raise exception
  File "<stdin>", line 3361, in run_ast_nodes
    if (await self.run_code(code, result,  async_=asy)):
  File "<stdin>", line 3458, in run_code
    self.showtraceback(running_compiled_code=True)
  File "<stdin>", line 2066, in showtraceback
    self._showtraceback(etype, value, stb)
  File "<stdin>", line 72, in exceptionCatcher
    raise exception
  File "<stdin>", line 3441, in run_code
    exec(code_obj, self.user_global_ns, self.user_ns)
  File "<stdin>", line 1, in <module>
    gdp_pop.pop + gdp_pop.pop
TypeError: unsupported operand type(s) for +: 'method' and 'method'

Does anyone know what's going wrong here?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source