8000 String dtype: implement object-dtype based StringArray variant with NumPy semantics by jorisvandenbossche · Pull Request #58451 · pandas-dev/pandas · GitHub
[go: up one dir, main page]

Skip to content

String dtype: implement object-dtype based StringArray variant with NumPy semantics #58451

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

Merged
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
63a7fc5
String dtype: implement object-dtype based StringArray variant with N…
jorisvandenbossche Apr 27, 2024
0eee625
fix constructor to not convert to NA
jorisvandenbossche Apr 27, 2024
607b95e
fix typing
jorisvandenbossche Apr 27, 2024
bca157d
improve logic in str_map
jorisvandenbossche Apr 27, 2024
79eb3b4
Merge remote-tracking branch 'upstream/main' into string-dtype-object
jorisvandenbossche Jul 26, 2024
c063298
Merge remote-tracking branch 'upstream/main' into string-dtype-object
jorisvandenbossche Jul 30, 2024
ab96aa4
remove most usage of python_numpy
jorisvandenbossche Jul 30, 2024
bae8d65
update tests to avoid string[python_numpy]
jorisvandenbossche Jul 30, 2024
31f1c33
Merge remote-tracking branch 'upstream/main' into string-dtype-object
jorisvandenbossche Jul 31, 2024
cbd0820
Merge remote-tracking branch 'upstream/main' into string-dtype-object
jorisvandenbossche Aug 1, 2024
864c166
remove all python_numpy usage
jorisvandenbossche Aug 1, 2024
d3ad7b0
remove hardcoded storage
jorisvandenbossche Aug 2, 2024
028dc2c
implement any/all reductions
jorisvandenbossche Aug 2, 2024
1750bcb
Merge remote-tracking branch 'upstream/main' into string-dtype-object
jorisvandenbossche Aug 3, 2024
7f4baf7
fix typing
jorisvandenbossche Aug 3, 2024
fdf1454
Merge remote-tracking branch 'upstream/main' into string-dtype-object
jorisvandenbossche Aug 7, 2024
fe6fce6
Update pandas/core/arrays/string_.py
jorisvandenbossche Aug 7, 2024
70325d4
update todo comment
jorisvandenbossche Aug 7, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix typing
  • Loading branch information
jorisvandenbossche committed Apr 27, 2024
commit 607b95e376528ca690988716edf8034158f227c1
4 changes: 2 additions & 2 deletions pandas/_testing/asserters.py
Original file line number Diff line number Diff line change
Expand Up @@ -808,11 +808,11 @@ def assert_extension_array_equal(
# Specifically for StringArrayNumpySemantics, validate here we have a valid array
if isinstance(left.dtype, StringDtype) and left.dtype.storage == "python_numpy":
assert np.all(
[np.isnan(val) for val in left._ndarray[left_na]]
[np.isnan(val) for val in left._ndarray[left_na]] # type: ignore[attr-defined]
), "wrong missing value sentinels"
if isinstance(right.dtype, StringDtype) and right.dtype.storage == "python_numpy":
assert np.all(
[np.isnan(val) for val in right._ndarray[right_na]]
[np.isnan(val) for val in right._ndarray[right_na]] # type: ignore[attr-defined]
), "wrong missing value sentinels"

left_valid = left[~left_na].to_numpy(dtype=object)
Expand Down
2 changes: 1 addition & 1 deletion pandas/core/arrays/string_.py
Original file line number Diff line number Diff line change
Expand Up @@ -718,7 +718,7 @@ def _from_sequence(
dtype = StringDtype(storage="python_numpy")
return super()._from_sequence(scalars, dtype=dtype, copy=copy)

def _from_backing_data(self, arr: np.ndarray) -> NumpyExtensionArray:
def _from_backing_data(self, arr: np.ndarray) -> StringArrayNumpySemantics:
# need to overrde NumpyExtensionArray._from_backing_data to ensure
# we always preserve the dtype
return NDArrayBacked._from_backing_data(self, arr)
Expand Down
0