Skip to content
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

BUG: concat warning bubbling up through str.cat #23725

Merged
merged 1 commit into from
Nov 17, 2018

Conversation

h-vetinari
Copy link
Contributor

@h-vetinari h-vetinari commented Nov 15, 2018

This was an unexpected realisation from #23723 -- the change of pd.concat in #20613 to add sort and raise a warning if it's not specified was not caught in the .str.cat code, because it was being shadowed (apparently in all relevant tests) by another FutureWarning that's being raised if join is not specified (from #20347).

This PR only adds the kwarg to the .str.cat internals where necessary.

Example from #23723:

>>> import pandas as pd
>>> s2 = pd.Series(['a', 'b', 'c', 'd'], index=['a', 'b', 'c', 'd'])
>>> u2 = pd.Series(['b', 'd', 'a', 'c'], index=['b', 'd', 'a', 'c'])
>>> s2.str.cat([pd.Index(['d', 'c', 'b', 'a']), u2, u2.values], na_rep='-', join='left')
[...] FutureWarning: Sorting because non-concatenation axis is not aligned. A future version
of pandas will change to not sort by default.
To accept the future behavior, pass 'sort=False'.
To retain the current behavior and silence the warning, pass 'sort=True'.
a    aaab
b    bbbd
c    ccca
d    dddc
dtype: object

@pep8speaks
Copy link

Hello @h-vetinari! Thanks for submitting the PR.

@h-vetinari
Copy link
Contributor Author

Aaaaaand, another flaky hypothesis failure.

@gfyoung gfyoung added Reshaping Concat, Merge/Join, Stack/Unstack, Explode Strings String extension data type and string data labels Nov 16, 2018
@codecov
Copy link

codecov bot commented Nov 16, 2018

Codecov Report

Merging #23725 into master will not change coverage.
The diff coverage is 100%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master   #23725   +/-   ##
=======================================
  Coverage   92.25%   92.25%           
=======================================
  Files         161      161           
  Lines       51383    51383           
=======================================
  Hits        47404    47404           
  Misses       3979     3979
Flag Coverage Δ
#multiple 90.64% <100%> (ø) ⬆️
#single 42.31% <0%> (ø) ⬆️
Impacted Files Coverage Δ
pandas/core/strings.py 98.58% <100%> (ø) ⬆️
pandas/plotting/_core.py 83.63% <0%> (ø) ⬆️
pandas/core/indexing.py 93.87% <0%> (ø) ⬆️
pandas/core/generic.py 96.82% <0%> (ø) ⬆️
pandas/core/arrays/categorical.py 95.34% <0%> (ø) ⬆️
pandas/core/window.py 96.4% <0%> (ø) ⬆️
pandas/core/arrays/datetimes.py 98.47% <0%> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update a23f901...9fc50e8. Read the comment docs.

@jreback jreback added this to the 0.24.0 milestone Nov 17, 2018
@jreback jreback merged commit f8727ce into pandas-dev:master Nov 17, 2018
@jreback
Copy link
Contributor

jreback commented Nov 17, 2018

thanks!

@h-vetinari h-vetinari deleted the str_cat_wrong_warning branch November 18, 2018 12:02
tm9k1 pushed a commit to tm9k1/pandas that referenced this pull request Nov 19, 2018
Pingviinituutti pushed a commit to Pingviinituutti/pandas that referenced this pull request Feb 28, 2019
Pingviinituutti pushed a commit to Pingviinituutti/pandas that referenced this pull request Feb 28, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Reshaping Concat, Merge/Join, Stack/Unstack, Explode Strings String extension data type and string data
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants