Skip to content

Commit 1c06234

Browse files
committed
Incorporate review feedback
1 parent 58a8e42 commit 1c06234

File tree

2 files changed

+21
-20
lines changed

2 files changed

+21
-20
lines changed

doc/source/text.rst

+3-3
Original file line numberDiff line numberDiff line change
@@ -266,8 +266,8 @@ Concatenating a Series and an indexed object into a Series, with alignment
266266

267267
.. versionadded:: 0.23.0
268268

269-
For concatenation with a ``Series`` or ``DataFrame``, it is possible to align the respective indexes before concatenation by setting
270-
the ``join``-keyword, which controls the manner of alignment.
269+
For concatenation with a ``Series`` or ``DataFrame``, it is possible to align the indexes before concatenation by setting
270+
the ``join``-keyword.
271271

272272
.. ipython:: python
273273
@@ -282,7 +282,7 @@ the ``join``-keyword, which controls the manner of alignment.
282282
If the ``join`` keyword is not passed, the method :meth:`~Series.str.cat` will currently fall back to the behavior before version 0.23.0 (i.e. no alignment),
283283
but a ``FutureWarning`` will be raised if any of the involved indexes differ, since this default will change to ``join='left'`` in a future version.
284284

285-
To usual options are available for ``join`` (one of ``'left', 'outer', 'inner', 'right'``).
285+
The usual options are available for ``join`` (one of ``'left', 'outer', 'inner', 'right'``).
286286
In particular, alignment also means that the different lengths do not need to coincide anymore.
287287

288288
.. ipython:: python

pandas/core/strings.py

+18-17
Original file line numberDiff line numberDiff line change
@@ -1964,34 +1964,34 @@ def _get_series_list(self, others, ignore_index=False):
19641964

19651965
err_msg = ('others must be Series, Index, DataFrame, np.ndarrary or '
19661966
'list-like (either containing only strings or containing '
1967-
'only objects of type Series/Index/list-like/np.ndarray')
1967+
'only objects of type Series/Index/list-like/np.ndarray)')
19681968

19691969
if isinstance(others, Series):
1970-
fut_warn = not others.index.equals(idx)
1970+
fu_wrn = not others.index.equals(idx)
19711971
los = [Series(others.values, index=idx)
1972-
if ignore_index and fut_warn else others]
1973-
return (los, fut_warn)
1972+
if ignore_index and fu_wrn else others]
1973+
return (los, fu_wrn)
19741974
elif isinstance(others, Index):
1975-
fut_warn = not others.equals(idx)
1975+
fu_wrn = not others.equals(idx)
19761976
los = [Series(others.values,
19771977
index=(idx if ignore_index else others))]
1978-
return (los, fut_warn)
1978+
return (los, fu_wrn)
19791979
elif isinstance(others, DataFrame):
1980-
fut_warn = not others.index.equals(idx)
1981-
if ignore_index and fut_warn:
1980+
fu_wrn = not others.index.equals(idx)
1981+
if ignore_index and fu_wrn:
19821982
# without copy, this could change "others"
19831983
# that was passed to str.cat
19841984
others = others.copy()
19851985
others.index = idx
1986-
return ([others[x] for x in others], fut_warn)
1986+
return ([others[x] for x in others], fu_wrn)
19871987
elif isinstance(others, np.ndarray) and others.ndim == 2:
19881988
others = DataFrame(others, index=idx)
19891989
return ([others[x] for x in others], False)
19901990
elif is_list_like(others):
19911991
others = list(others) # ensure iterators do not get read twice etc
19921992
if all(is_list_like(x) for x in others):
19931993
los = []
1994-
fut_warn = False
1994+
fu_wrn = False
19951995
while others:
19961996
nxt = others.pop(0) # list-like as per check above
19971997
# safety for iterators and other non-persistent list-likes
@@ -2016,10 +2016,11 @@ def _get_series_list(self, others, ignore_index=False):
20162016
if not is_legal or isinstance(nxt, DataFrame):
20172017
raise TypeError(err_msg)
20182018

2019-
tmp = self._get_series_list(nxt, ignore_index=ignore_index)
2020-
los = los + tmp[0]
2021-
fut_warn = fut_warn or tmp[1]
2022-
return (los, fut_warn)
2019+
nxt, fwn = self._get_series_list(nxt,
2020+
ignore_index=ignore_index)
2021+
los = los + nxt
2022+
fu_wrn = fu_wrn or fwn
2023+
return (los, fu_wrn)
20232024
# test if there is a mix of list-like and non-list-like (e.g. str)
20242025
elif (any(is_list_like(x) for x in others)
20252026
and any(not is_list_like(x) for x in others)):
@@ -2186,8 +2187,8 @@ def cat(self, others=None, sep=None, na_rep=None, join=None):
21862187

21872188
try:
21882189
# turn anything in "others" into lists of Series
2189-
tmp = self._get_series_list(others, ignore_index=(join is None))
2190-
others, fut_warn = tmp
2190+
others, fu_wrn = self._get_series_list(others,
2191+
ignore_index=(join is None))
21912192
except ValueError: # do not catch TypeError raised by _get_series_list
21922193
if join is None:
21932194
raise ValueError('All arrays must be same length, except '
@@ -2198,7 +2199,7 @@ def cat(self, others=None, sep=None, na_rep=None, join=None):
21982199
'must all be of the same length as the '
21992200
'calling Series/Index.')
22002201

2201-
if join is None and fut_warn:
2202+
if join is None and fu_wrn:
22022203
warnings.warn("A future version of pandas will perform index "
22032204
"alignment when `others` is a Series/Index/"
22042205
"DataFrame (or a list-like containing one). To "

0 commit comments

Comments
 (0)