0

I am merging multiple dataframes, which have the same columns. I am using concat since it is more efficient than append apparently. The dataframes have indexes from 0 to n-1, that is why I put ignore_index to True so that the combined dataframe will have indexes from 0 to n-1.

df=pd.concat(dfs,ignore_index=True)

dfs is a python list of multiple dataframes.

I get this warning.

C:/Users/XXX/Documents/XX/XXX/test/football.py:512: 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'.

  df=pd.concat(dfs,ignore_index=True)

I am not sure what exactly it means. The dataframes have different amount of rows, but the columns should be the same.

non-concatenation axis is not aligned

Is these saying that the columns are not same in all of the dataframes? If so what does sort do?

Borut Flis
  • 15,715
  • 30
  • 92
  • 119

0 Answers0