-
-
Notifications
You must be signed in to change notification settings - Fork 18.6k
TST: Add test to verify DataFrame's constructor doesn't convert Nones to strings on string columns #40912
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
TST: Add test to verify DataFrame's constructor doesn't convert Nones to strings on string columns #40912
Conversation
def test_consistency_of_string_columns_with_none(self): | ||
# df created from list, None is casted to str | ||
df = DataFrame(["1", "2", None], columns=["a"], dtype="str") | ||
type(df.loc[2].values[0]) |
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.
so this is not actually testing anything, instead you need to actually construct the expected frame and use assert_frame_equal. more to the point, I am pretty sure we have tests very similar to this. happy to take if we don't, but pls have a look (would take this if its slightly different than what we have, so pls give a look). we have a ton of tests so have to look around a bit.
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.
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.
yeah if you'd have a look around. I recall a similar issue to this but nothing referenced, pls have a look see at the existing tests (I know there are a lot)
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.
It was fixed in 1.2.0 (but broken in 1.1.5), but I don't directly find anything in the 1.2.0 notes about this (and also didn't directly find an issue about it). So I think it is fine to add the test to be safe.
This pull request is stale because it has been open for thirty days with no activity. Please update or respond to this comment if you're still interested in working on this. |
@cgarciae can you merge master to resolve conflicts and can take a look |
closing as stale |
whatsnew
Adds a very simple test to verify that
None
s are not casted to strings as"None"
inside the DataFrame's constructor for string columns.Questions: