-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
Fix inference for fixed with numpy strings with arrow string option #54496
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2107,6 +2107,14 @@ def test_series_string_inference_scalar(self): | |
ser = Series("a", index=[1]) | ||
tm.assert_series_equal(ser, expected) | ||
|
||
def test_series_string_inference_array_string_dtype(self): | ||
# GH#54496 | ||
pa = pytest.importorskip("pyarrow") | ||
expected = Series(["a", "b"], dtype=pd.ArrowDtype(pa.string())) | ||
with pd.option_context("future.infer_string", True): | ||
ser = Series(np.array(["a", "b"])) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It might be good to specify dtype explictly here. Not sure how numpy's string dtype work is coming along, but just in case that becomes the default, it would be good to future-proof this. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'd prefer to keep this, we should infer the default type as arrow backed strings for now, that's the mos common use case for users |
||
tm.assert_series_equal(ser, expected) | ||
|
||
|
||
class TestSeriesConstructorIndexCoercion: | ||
def test_series_constructor_datetimelike_index_coercion(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.
Can you add a test for a 2-D string ndarray?
e.g.
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.
added