'Using Pandas: function matches column name, unable to perform function [duplicate]
I was given a table by a client named with a column named "rank",
and I'm trying to convert the values in that column to an int type, but when I try to run the df.rank.astype(int) function on the column it thinks I'm trying to run the .astype() function on the .rank() function. Any way to prevent this?
df.rank.astype()
AttributeError: 'function' object has no attribute 'astype'
Solution 1:[1]
You can set declare the column using []
df['rank'] = df['rank'].astpye()
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | ArchAngelPwn |
