joinery icon indicating copy to clipboard operation
joinery copied to clipboard

Concatenate two dataframes with same columns

Open Nicinic opened this issue 5 years ago • 8 comments

Hi, I'm using Joinery on a project to compute statistics inside a simulator. I'm looking for the best way to concatenate two dataframes that have the same columns (since they were extracted from the same main dataframe). However, I haven't found a way to do this with joinery, and I kindadoubt that adding each row of the second dataframe to the first is a good solution to this problem. Is there a method to concatenate two dataframes, similar to the method "concat" in pandas ?

If i use join with the Outer JoinType, each column gets dupliacted into right and left ones which isn't the result I want.

Thank you

Nicinic avatar Mar 24 '20 14:03 Nicinic

Does append give the desired result?

cardillo avatar Mar 24 '20 22:03 cardillo

Yes it is possible to iterate over the second dataframe and append each row to the first dataframe to obtain the desired result DataFrame<Object> df = ... ; DataFrame<Object> df2 = ...; for(List<Object> row : df2) { df.append(row); }

But is it really the optimal way to do it ?

Nicinic avatar Mar 24 '20 23:03 Nicinic

Agree, not ideal, but should get you going today. I'll look at adding a more efficient concat implementation to next release.

cardillo avatar Mar 25 '20 13:03 cardillo

Thanks. I will use this solution until the new version comes out. And thanks a lot for this library

Nicinic avatar Mar 25 '20 14:03 Nicinic

Hi, I would like to contribute. Can you assign it to me? If not, I will start working on it!

jihoonkang0829 avatar Oct 16 '21 23:10 jihoonkang0829

Thanks @jihoonkang0829, please submit a PR when you're ready.

cardillo avatar Oct 17 '21 15:10 cardillo

can you assign it to me , would like to contribute

pkatre2 avatar Oct 23 '21 14:10 pkatre2

Can you assign it to me? I would like to contribute

donggua223344 avatar Nov 11 '21 16:11 donggua223344