I have multiple dataframes and there are couple of dfs having similar IDs. I want to merge those dfs if they have similar row count.
df1_ID1
ID b c d
1 x y z
1 y z x
1 z x y
df2_ID1
ID b c d
1 x y z
1 y z x
1 z x y
df3_ID2
ID b c d
2 x y z
2 y z x
2 z x y
what I want is
ID1
ID b c d b c d
1 x y z x y z
1 y z x y z x
1 z x y z x y
I'm trying something like this code:
for (i in 1:length(df)) {
columnnames<-df[[i]][["b"]]
if (df[[i]][["ID"]] == df[[i++]][["ID"]])
merge.data.frame(df[[i]],df[[i++]], by = "ID")
}
rcode, and hasrin the title. If there is somepandasorpythonrelated please update your question to reflect these elements and add the tags back.