-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
String dtype: still return nullable NA-variant in object inference (maybe_converts_object
) if requested
#59487
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 4 commits
03d4943
c005778
0bee1ac
0057158
c56c5f5
8af4cda
7b73c04
aa89c32
8b92517
548b501
5fbde9f
5cb76d0
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 |
---|---|---|
|
@@ -130,9 +130,9 @@ | |
from pandas.core.arrays.integer import IntegerArray | ||
import pandas.core.common as com | ||
from pandas.core.construction import ( | ||
array as pd_array, | ||
ensure_wrapped_if_datetimelike, | ||
extract_array, | ||
sanitize_array, | ||
) | ||
from pandas.core.indexers import ( | ||
check_array_indexer, | ||
|
@@ -667,12 +667,10 @@ def _validate_listlike(self, value, allow_object: bool = False): | |
msg = self._validation_error_message(value, True) | ||
raise TypeError(msg) from err | ||
|
||
# Do type inference if necessary up front (after unpacking | ||
# NumpyExtensionArray) | ||
# Do type inference if necessary up front | ||
# e.g. we passed PeriodIndex.values and got an ndarray of Periods | ||
value = extract_array(value, extract_numpy=True) | ||
value = pd_array(value) | ||
value = extract_array(value, extract_numpy=True) | ||
value = sanitize_array(value, index=None) | ||
value = ensure_wrapped_if_datetimelike(value) | ||
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. This is essentially the default input sanitation/inference we do for the Series constructor (and other places), so switched to use that here instead of (this mostly impacts the name of the type in the error message) |
||
|
||
if is_all_strings(value): | ||
# We got a StringArray | ||
|
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.
Essentially this diff is just switching the order of the
if
/elif
blocks, to first check if we want a nullable dtype and only then check if we want the future default string dtype.