-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
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(string dtype): Resolve xfails in test_from_dummies #60694
base: main
Are you sure you want to change the base?
Conversation
…xfail_from_dummies
@jorisvandenbossche @WillAyd friendly ping |
This is a tough one but I don't think we should do any special-casing in this method, so should just stick with what the different string types do (even though coercion may not be consistent) |
@WillAyd - coming back to this, what do you think of raising? Currently specifying a float when columns are integers raises. My desired behavior with strings would be the same: if you give an integer value and your columns are string dtypes, we should raise. If we do agree that's what we want, I think we should hold off on this one until 3.0. |
Yea generally I think its a good idea to be more strict about the data types, especially with the dedicated string type. So I'd be in favor of raising instead of coercing |
doc/source/whatsnew/vX.X.X.rst
file if fixing a bug or adding a new feature.The current behavior assumes the
default_category
provided can be coerced to the dtype of the input's columns. When the input's columns labels are strings, and thedefault_category
is an integer, currently with object dtype we end up with values that are a mix of strings and integers. Withinfer_string=True
where the input's columns arestr
dtype, we end up instead with all strings (coercing the integer to a string).It's not clear to me whether this case should result in object dtype with a mix of strings and integers, or
str
dtype. Thoughts here are welcome. A few cases to consider are below. Currently I'm going with backwards compatibility, but open to other directions.