pandas: "Concatenation will no longer sort" wording is very inconsistent

The wording in the update docs is (emphasis added):

In a future version of pandas pandas.concat() will no longer sort the non-concatenation axis when it is not already aligned. (…)

To keep the previous behavior (sorting) and silence the warning, pass sort=True. To accept the future behavior (no sorting), pass sort=False

https://pandas-docs.github.io/pandas-docs-travis/whatsnew.html#concatenation-will-no-longer-sort

But the wording in the FutureWarning messages is (emphasis added):

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

https://github.com/pandas-dev/pandas/blob/c4da79b5b322c73d8e61d1cb98ac4ab1e2438b40/pandas/core/indexes/api.py

It needs to be clearer that current default is still sort=True but will revert to sort=False in a future version.

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Comments: 15 (7 by maintainers)

Commits related to this issue

Most upvoted comments

Ok, I found it. It actually was an append command (not concat or merge). Adding the sort parameter did remove the warning. I added the sort=False parameter to this: df_B = df_A.append(df_B, verify_integrity=True, sort=False).copy()

also: Currently the warning doesn’t get silenced if you pass “sort=False” (i.e. the true future default behavior)–presumably there should be no warning as long as the sort parameter is explicitly set (passed).

You can make warnings raise. Something like

import warnings

warnings.simplefilter("error")
<your code>

On Mon, May 21, 2018 at 2:06 PM, techvslife notifications@github.com wrote:

Sorry, I’m not having luck reproducing with a small example; may not be a concat command, but a merge command instead. Unfortunately I don’t know what line in code is triggering the warning from the warning.

— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub https://github.com/pandas-dev/pandas/issues/21112#issuecomment-390751519, or mute the thread https://github.com/notifications/unsubscribe-auth/ABQHIgfJzYneJoqF0VaPK1WMQhQlSp9lks5t0xAngaJpZM4UD6_G .