8000 Add allow_sets-kwarg to is_list_like by h-vetinari · Pull Request #23065 · pandas-dev/pandas · GitHub
[go: up one dir, main page]

Skip to content

Add allow_sets-kwarg to is_list_like #23065

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 21 commits into from
Oct 18, 2018
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
Split off changes in strings.py
  • Loading branch information
h-vetinari committed Oct 16, 2018
commit 3647bdd68b66c16fd5ec95cb78c758fd3ed2e523
9 changes: 4 additions & 5 deletions pandas/core/strings.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
is_object_dtype,
is_string_like,
is_list_like,
is_ordered_list_like,
is_scalar,
is_integer,
is_re)
Expand Down Expand Up @@ -1997,12 +1996,12 @@ def _get_series_list(self, others, ignore_index=False):
elif isinstance(others, np.ndarray) and others.ndim == 2:
others = DataFrame(others, index=idx)
return ([others[x] for x in others], False)
elif is_ordered_list_like(others):
elif is_list_like(others):
others = list(others) # ensure iterators do not get read twice etc

# in case of list-like `others`, all elements must be
# either one-dimensional list-likes or scalars
if all(is_ordered_list_like(x) for x in others):
if all(is_list_like(x) for x in others):
los = []
join_warn = False
depr_warn = False
Expand Down Expand Up @@ -2030,7 +2029,7 @@ def _get_series_list(self, others, ignore_index=False):
# nested list-likes are forbidden:
# -> elements of nxt must not be list-like
is_legal = ((no_deep and nxt.dtype == object)
or all(not is_ordered_list_like(x)
or all(not is_list_like(x)
for x in nxt))

# DataFrame is false positive of is_legal
Expand All @@ -2049,7 +2048,7 @@ def _get_series_list(self, others, ignore_index=False):
'deprecated and will be removed in a future '
'version.', FutureWarning, stacklevel=3)
return (los, join_warn)
elif all(not is_ordered_list_like(x) for x in others):
elif all(not is_list_like(x) for x in others):
return ([Series(others, index=idx)], False)
raise TypeError(err_msg)

Expand Down
0