combine two dataframe columns python code example
Example 1: Joins with another DataFrame
df.join(df2, df.name == df2.name, 'outer').select(
df.name, df2.height).collect()
df.join(df2, 'name', 'outer').select('name', 'height').collect()
cond = [df.name == df3.name, df.age == df3.age]
df.join(df3, cond, 'outer').select(df.name, df3.age).collect()
df.join(df2, 'name').select(df.name, df2.height).collect()
df.join(df4, ['name', 'age']).select(df.name, df.age).collect()
Example 2: merge two columns pandas
df["period"] = df["Year"] + df["quarter"]
Example 3: merge two df
bigdata = pd.concat([data1, data2], ignore_index=True, sort=False)