cardillo / joinery

Data frames for Java
https://joinery.sh
GNU General Public License v3.0
695 stars 167 forks source link

Concatenate two dataframes with same columns #83

Open Nicinic opened 4 years ago

Nicinic commented 4 years ago

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

cardillo commented 4 years ago

Does append give the desired result?

Nicinic commented 4 years ago

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 ?

cardillo commented 4 years ago

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

Nicinic commented 4 years ago

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

jihoonkang0829 commented 2 years ago

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

cardillo commented 2 years ago

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

pkatre2 commented 2 years ago

can you assign it to me , would like to contribute

donggua223344 commented 2 years ago

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