Leftjoin order of dataframe

Hi all,

I have updated my DataFrames package from v0.22.5 to v1.1.1.

I have a leftjoin function in my code that is no longer working as expected. The leftjoin function has changed order from the first dataframe.

e.g. leftjoin(dataframe1, dataframe2, on =:column_header)

Previous to updating my package, the order of the leftjoin was identical to dataframe1.

Does anyone know if it is possible to ensure that the order remains the same as dataframe1?

Thanks in advance!

The order is not preserved. This is listed in the docstring of leftjoin.

You can sort after the join to get the preferred ordering.

3 Likes

Thank you! Is this something that changed recently or has this always been the case? Before I updated DataFrames the order of the data was preserved.

yes it looks like a 1.0 breaking change. See here.

1 Like

Thank you! :slight_smile:

See https://github.com/JuliaData/DataFrames.jl/issues/2753 for a discussion. If you would like to see improvements in this area please comment there.

1 Like