-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
use is_integer in df.insert #53194
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
use is_integer in df.insert #53194
Conversation
@@ -4800,7 +4800,7 @@ def insert( | |||
if not allow_duplicates and column in self.columns: | |||
# Should this be a different kind of error?? | |||
raise ValueError(f"cannot insert {column}, already exists") | |||
if not isinstance(loc, int): | |||
if not is_integer(loc): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you convert non stdlib ints to satisfy typing checks?
@@ -110,3 +110,8 @@ def test_insert_frame(self): | |||
) | |||
with pytest.raises(ValueError, match=msg): | |||
df.insert(1, "newcol", df) | |||
|
|||
def test_insert_int64_loc(self): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you add the GH
issue number?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you add a whatsnew note in v2.1.0.rst?
Which section of the whatsnew note should I add it to, Conversion? |
Sure |
done
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM.
Thanks, @auderson. |
doc/source/whatsnew/vX.X.X.rst
file if fixing a bug or adding a new feature.