Stop concat from attempting to sort mismatched columns by default by brycepg · Pull Request #20613 · pandas-dev/pandas (original) (raw)

Ah, yes, that might be needed as well. But what I meant was other keywords of concat itself. Eg does the sort keyword work for both join='inner' and join='outer' ?

We'll need to address this.

In [2]: df1 = pd.DataFrame({"a": [1, 2], "b": [1, 2], "c": [1, 2]}, columns=['b', 'a', 'c'])

In [3]: df2 = pd.DataFrame({"a": [1, 2], 'c': [3, 4]}, index=[3, 4])

In [4]: pd.concat([df1, df2], join='inner') Out[4]: a c 0 1 1 1 2 2 3 1 3 4 2 4

In [5]: pd.concat([df1, df2], join='inner', sort=False) Out[5]: a c 0 1 1 1 2 2 3 1 3 4 2 4

I assume we want the same behavior as for join='outer'.