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

TST: Additional tests for concat(sort) argument #20909

Closed
TomAugspurger opened this issue May 1, 2018 · 6 comments
Closed

TST: Additional tests for concat(sort) argument #20909

TomAugspurger opened this issue May 1, 2018 · 6 comments
Labels
Reshaping Concat, Merge/Join, Stack/Unstack, Explode Testing pandas testing functions or related to the test suite
Milestone

Comments

@TomAugspurger
Copy link
Contributor

Followup to #20613

Ideally, we would specify this everywhere we use concat internally. In many contexts, it will be irrelevant since things should be already sorted & aligned.

Need to determine the old behavior, and then match that.

@TomAugspurger TomAugspurger added Testing pandas testing functions or related to the test suite Reshaping Concat, Merge/Join, Stack/Unstack, Explode Blocker Blocking issue or pull request for an upcoming release labels May 1, 2018
@TomAugspurger TomAugspurger added this to the 0.23.0 milestone May 1, 2018
@TomAugspurger
Copy link
Contributor Author

Also this comment on a refactor to simplify #20613 (comment) _unique_indices

@jorisvandenbossche
Copy link
Member

One case where this warning pops up from the pandas internals is the following example in the docs (http://pandas-docs.github.io/pandas-docs-travis/basics.html#mixed-dtypes):

In [1]: In [167]: mdf = pd.DataFrame({'A': [1, 2, 3],
   ...:    .....:                     'B': [1., 2., 3.],
   ...:    .....:                     'C': ['foo', 'bar', 'baz'],
   ...:    .....:                     'D': pd.date_range('20130101', periods=3)})
   ...:                     

In [2]:  mdf.agg(['min', 'sum'])
/home/joris/scipy/pandas/pandas/core/base.py:611: 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=True'.

To retain the current behavior and silence the warning, pass sort=False

  return concat(results, keys=keys, axis=1)
Out[2]: 
     A    B          C          D
min  1  1.0        bar 2013-01-01
sum  6  6.0  foobarbaz        NaT

@TomAugspurger
Copy link
Contributor Author

Thanks. Pushing a test / fix now.

@jorisvandenbossche
Copy link
Member

There are some other warnings as well in the doc build, but it might be most of those are OK with a :okwarning: (which is not urgent as it is not shown in the actual html docs). Will go through them.

@jorisvandenbossche
Copy link
Member

So I think the other warnings are OK, it's mainly from concatting two dataframes with eg columns "A B C D" and "C D E F", where sort=True or sort=False does not matter for the actual result (both give the same).

@jorisvandenbossche jorisvandenbossche modified the milestones: 0.23.0, 0.23.1 May 15, 2018
@jreback jreback modified the milestones: 0.23.1, 0.23.2 Jun 7, 2018
@jreback jreback modified the milestones: 0.23.2, 0.23.3 Jun 26, 2018
@jreback jreback modified the milestones: 0.23.4, 0.24.0 Aug 2, 2018
@jreback jreback modified the milestones: 0.24.0, 0.25.0 Nov 6, 2018
@jreback jreback modified the milestones: 0.25.0, 1.0 Apr 20, 2019
@TomAugspurger TomAugspurger removed the Blocker Blocking issue or pull request for an upcoming release label Jun 20, 2019
@TomAugspurger
Copy link
Contributor Author

I think we've enforced this deprecation, so considering this closed.

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 Testing pandas testing functions or related to the test suite
Projects
None yet
Development

No branches or pull requests

3 participants