8000 PERF: StringArray construction by topper-123 · Pull Request #36325 · pandas-dev/pandas · GitHub
[go: up one dir, main page]

Skip to content

PERF: StringArray construction #36325

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 4 commits into from
Sep 17, 2020
Merged
Changes from 1 commit
Commits
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
clean doc string
  • Loading branch information
topper-123 committed Sep 16, 2020
commit ee01e0282c59f845bd914d10b6a238c45abe1628
7 changes: 3 additions & 4 deletions pandas/core/arrays/string_.py
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ class StringArray(PandasArray):
Instantiating StringArrays directly with non-strings arrays will raise an error
unless ``convert=True``.

>>> pd.arrays.StringArray(np.array(['1', 1], dtype=object))
>>> pd.arrays.StringArray(np.array(['1', 1]))
ValueError: StringArray requires a sequence of strings or pandas.NA
>>> pd.arrays.StringArray(['1', 1], convert=True)
<StringArray>
Expand All @@ -190,9 +190,8 @@ def __init__(self, values, copy=False, convert: bool = False):
values = extract_array(values)
if not isinstance(values, type(self)):
if convert:
values = lib.ensure_string_array(
values, na_value=StringDtype.na_value, copy=copy
)
na_val = StringDtype.na_value
values = lib.ensure_string_array(values, na_value=na_val, copy=copy)
else:
self._validate(values)

Expand Down
0