description |
---|
Merge DataFrame or named Series objects with a database-style join.The join is done on columns or indexes. |
danfo.merge(options)
Parameters | Type | Description |
---|---|---|
options | Object | left: A DataFrame or named Series object. right: Another DataFrame or named Series object. on: Column names to join on. Must be found in both the left and right DataFrame and/or Series objects. how: One of |
danfo.js merge function is similar to Pandas merge and performs in-memory join operations idiomatically very similar to relational databases like SQL.
danfo.js provides a single function, merge()
, as the entry point for all standard database join operations between DataFrame
or named Series
objects.
For a more intuitive understanding, this guide on the Pandas doc is worth reading.
In the following example, we perform an inner join. An inner join requires each row in the two joined DataFrames to have matching column values. This is similar to the intersection of two sets. It returns a DataFrame with only those rows that have common characteristics.
{% tabs %} {% tab title="Node" %}
const dfd = require("danfojs-node")
let data = [['K0', 'k0', 'A0', 'B0'], ['k0', 'K1', 'A1', 'B1'],
['K1', 'K0', 'A2', 'B2'], ['K2', 'K2', 'A3', 'B3']]
let data2 = [['K0', 'k0', 'C0', 'D0'], ['K1', 'K0', 'C1', 'D1'],
['K1', 'K0', 'C2', 'D2'], ['K2', 'K0', 'C3', 'D3']]
let colum1 = ['Key1', 'Key2', 'A', 'B']
let colum2 = ['Key1', 'Key2', 'A', 'D']
let df1 = new dfd.DataFrame(data, { columns: colum1 })
let df2 = new dfd.DataFrame(data2, { columns: colum2 })
df1.print()
df2.print()
let merge_df = dfd.merge({ "left": df1, "right": df2, "on": ["Key1"], how: "inner"})
merge_df.print()
{% endtab %}
{% tab title="Browser" %}
{% endtab %} {% endtabs %}
{% tabs %} {% tab title="Output" %}
//first DataFrame
βββββ€ββββββββββββββββββββ€ββββββββββββββββββββ€ββββββββββββββββββββ€ββββββββββββββββββββ
β β Key1 β Key2 β A β B β
βββββΌββββββββββββββββββββΌββββββββββββββββββββΌββββββββββββββββββββΌββββββββββββββββββββ’
β 0 β K0 β k0 β A0 β B0 β
βββββΌββββββββββββββββββββΌββββββββββββββββββββΌββββββββββββββββββββΌββββββββββββββββββββ’
β 1 β k0 β K1 β A1 β B1 β
βββββΌββββββββββββββββββββΌββββββββββββββββββββΌββββββββββββββββββββΌββββββββββββββββββββ’
β 2 β K1 β K0 β A2 β B2 β
βββββΌββββββββββββββββββββΌββββββββββββββββββββΌββββββββββββββββββββΌββββββββββββββββββββ’
β 3 β K2 β K2 β A3 β B3 β
βββββ§ββββββββββββββββββββ§ββββββββββββββββββββ§ββββββββββββββββββββ§ββββββββββββββββββββ
//Second DataFrame
βββββ€ββββββββββββββββββββ€ββββββββββββββββββββ€ββββββββββββββββββββ€ββββββββββββββββββββ
β β Key1 β Key2 β A β D β
βββββΌββββββββββββββββββββΌββββββββββββββββββββΌββββββββββββββββββββΌββββββββββββββββββββ’
β 0 β K0 β k0 β C0 β D0 β
βββββΌββββββββββββββββββββΌββββββββββββββββββββΌββββββββββββββββββββΌββββββββββββββββββββ’
β 1 β K1 β K0 β C1 β D1 β
βββββΌββββββββββββββββββββΌββββββββββββββββββββΌββββββββββββββββββββΌββββββββββββββββββββ’
β 2 β K1 β K0 β C2 β D2 β
βββββΌββββββββββββββββββββΌββββββββββββββββββββΌββββββββββββββββββββΌββββββββββββββββββββ’
β 3 β K2 β K0 β C3 β D3 β
βββββ§ββββββββββββββββββββ§ββββββββββββββββββββ§ββββββββββββββββββββ§ββββββββββββββββββββ
//After inner join on column 'Key1'
βββββ€ββββββββββββββββββββ€ββββββββββββββββββββ€ββββββββββββββββββββ€ββββββββββββββββββββ€ββββββββββββββββββββ€ββββββββββββββββββββ€ββββββββββββββββββββ
β β Key1 β Key2 β A β B β Key2_1 β A_1 β D β
βββββΌββββββββββββββββββββΌββββββββββββββββββββΌββββββββββββββββββββΌββββββββββββββββββββΌββββββββββββββββββββΌββββββββββββββββββββΌββββββββββββββββββββ’
β 0 β K0 β k0 β A0 β B0 β k0 β C0 β D0 β
βββββΌββββββββββββββββββββΌββββββββββββββββββββΌββββββββββββββββββββΌββββββββββββββββββββΌββββββββββββββββββββΌββββββββββββββββββββΌββββββββββββββββββββ’
β 1 β K1 β K0 β A2 β B2 β K0 β C1 β D1 β
βββββΌββββββββββββββββββββΌββββββββββββββββββββΌββββββββββββββββββββΌββββββββββββββββββββΌββββββββββββββββββββΌββββββββββββββββββββΌββββββββββββββββββββ’
β 2 β K1 β K0 β A2 β B2 β K0 β C2 β D2 β
βββββΌββββββββββββββββββββΌββββββββββββββββββββΌββββββββββββββββββββΌββββββββββββββββββββΌββββββββββββββββββββΌββββββββββββββββββββΌββββββββββββββββββββ’
β 3 β K2 β K2 β A3 β B3 β K0 β C3 β D3 β
βββββ§ββββββββββββββββββββ§ββββββββββββββββββββ§ββββββββββββββββββββ§ββββββββββββββββββββ§ββββββββββββββββββββ§ββββββββββββββββββββ§ββββββββββββββββββββ
{% endtab %} {% endtabs %}
Merging by two keys takes into consideration the keys appearing in bothleft
and right DataFrame.
{% tabs %} {% tab title="Node" %}
const dfd = require("danfojs-node")
let data = [['K0', 'k0', 'A0', 'B0'], ['k0', 'K1', 'A1', 'B1'],
['K1', 'K0', 'A2', 'B2'], ['K2', 'K2', 'A3', 'B3']]
let data2 = [['K0', 'k0', 'C0', 'D0'], ['K1', 'K0', 'C1', 'D1'],
['K1', 'K0', 'C2', 'D2'], ['K2', 'K0', 'C3', 'D3']]
let colum1 = ['Key1', 'Key2', 'A', 'B']
let colum2 = ['Key1', 'Key2', 'A', 'D']
let df1 = new dfd.DataFrame(data, { columns: colum1 })
let df2 = new dfd.DataFrame(data2, { columns: colum2 })
df1.print()
df2.print()
let merge_df = dfd.merge({ left: df1, right: df2,
on: ["Key1", 'Key2'], how: "inner"})
merge_df.print()
{% endtab %}
{% tab title="Browser" %}
{% endtab %} {% endtabs %}
{% tabs %} {% tab title="Output" %}
//first DataFrame
βββββ€ββββββββββββββββββββ€ββββββββββββββββββββ€ββββββββββββββββββββ€ββββββββββββββββββββ
β β Key1 β Key2 β A β B β
βββββΌββββββββββββββββββββΌββββββββββββββββββββΌββββββββββββββββββββΌββββββββββββββββββββ’
β 0 β K0 β k0 β A0 β B0 β
βββββΌββββββββββββββββββββΌββββββββββββββββββββΌββββββββββββββββββββΌββββββββββββββββββββ’
β 1 β k0 β K1 β A1 β B1 β
βββββΌββββββββββββββββββββΌββββββββββββββββββββΌββββββββββββββββββββΌββββββββββββββββββββ’
β 2 β K1 β K0 β A2 β B2 β
βββββΌββββββββββββββββββββΌββββββββββββββββββββΌββββββββββββββββββββΌββββββββββββββββββββ’
β 3 β K2 β K2 β A3 β B3 β
βββββ§ββββββββββββββββββββ§ββββββββββββββββββββ§ββββββββββββββββββββ§ββββββββββββββββββββ
//second DataFrame
βββββ€ββββββββββββββββββββ€ββββββββββββββββββββ€ββββββββββββββββββββ€ββββββββββββββββββββ
β β Key1 β Key2 β A β D β
βββββΌββββββββββββββββββββΌββββββββββββββββββββΌββββββββββββββββββββΌββββββββββββββββββββ’
β 0 β K0 β k0 β C0 β D0 β
βββββΌββββββββββββββββββββΌββββββββββββββββββββΌββββββββββββββββββββΌββββββββββββββββββββ’
β 1 β K1 β K0 β C1 β D1 β
βββββΌββββββββββββββββββββΌββββββββββββββββββββΌββββββββββββββββββββΌββββββββββββββββββββ’
β 2 β K1 β K0 β C2 β D2 β
βββββΌββββββββββββββββββββΌββββββββββββββββββββΌββββββββββββββββββββΌββββββββββββββββββββ’
β 3 β K2 β K0 β C3 β D3 β
βββββ§ββββββββββββββββββββ§ββββββββββββββββββββ§ββββββββββββββββββββ§ββββββββββββββββββββ
//After inner join on two keys
βββββ€ββββββββββββββββββββ€ββββββββββββββββββββ€ββββββββββββββββββββ€ββββββββββββββββββββ€ββββββββββββββββββββ€ββββββββββββββββββββ
β β Key1 β Key2 β A β B β A_1 β D β
βββββΌββββββββββββββββββββΌββββββββββββββββββββΌββββββββββββββββββββΌββββββββββββββββββββΌββββββββββββββββββββΌββββββββββββββββββββ’
β 0 β K0 β k0 β A0 β B0 β C0 β D0 β
βββββΌββββββββββββββββββββΌββββββββββββββββββββΌββββββββββββββββββββΌββββββββββββββββββββΌββββββββββββββββββββΌββββββββββββββββββββ’
β 1 β K1 β K0 β A2 β B2 β C1 β D1 β
βββββΌββββββββββββββββββββΌββββββββββββββββββββΌββββββββββββββββββββΌββββββββββββββββββββΌββββββββββββββββββββΌββββββββββββββββββββ’
β 2 β K1 β K0 β A2 β B2 β C2 β D2 β
βββββ§ββββββββββββββββββββ§ββββββββββββββββββββ§ββββββββββββββββββββ§ββββββββββββββββββββ§ββββββββββββββββββββ§ββββββββββββββββββββ
{% endtab %} {% endtabs %}
The how parameter takes other types of joins like left, right and outer join and these are similar to their SQL equivalent
{% tabs %} {% tab title="Node" %}
const dfd = require("danfojs-node")
let data = [['K0', 'k0', 'A0', 'B0'], ['k0', 'K1', 'A1', 'B1'],
['K1', 'K0', 'A2', 'B2'], ['K2', 'K2', 'A3', 'B3']]
let data2 = [['K0', 'k0', 'C0', 'D0'], ['K1', 'K0', 'C1', 'D1'],
['K1', 'K0', 'C2', 'D2'], ['K2', 'K0', 'C3', 'D3']]
let colum1 = ['Key1', 'Key2', 'A', 'B']
let colum2 = ['Key1', 'Key2', 'A', 'D']
let df1 = new dfd.DataFrame(data, { columns: colum1 })
let df2 = new dfd.DataFrame(data2, { columns: colum2 })
df1.print()
df2.print()
let merge_df = dfd.merge({ left: df1, right: df2,
on: ["Key1"], how: "outer"})
merge_df.print()
{% endtab %}
{% tab title="Browser" %}
{% endtab %} {% endtabs %}
{% tabs %} {% tab title="Output" %}
//First DataFrame
βββββ€ββββββββββββββββββββ€ββββββββββββββββββββ€ββββββββββββββββββββ€ββββββββββββββββββββ
β β Key1 β Key2 β A β B β
βββββΌββββββββββββββββββββΌββββββββββββββββββββΌββββββββββββββββββββΌββββββββββββββββββββ’
β 0 β K0 β k0 β A0 β B0 β
βββββΌββββββββββββββββββββΌββββββββββββββββββββΌββββββββββββββββββββΌββββββββββββββββββββ’
β 1 β k0 β K1 β A1 β B1 β
βββββΌββββββββββββββββββββΌββββββββββββββββββββΌββββββββββββββββββββΌββββββββββββββββββββ’
β 2 β K1 β K0 β A2 β B2 β
βββββΌββββββββββββββββββββΌββββββββββββββββββββΌββββββββββββββββββββΌββββββββββββββββββββ’
β 3 β K2 β K2 β A3 β B3 β
βββββ§ββββββββββββββββββββ§ββββββββββββββββββββ§ββββββββββββββββββββ§ββββββββββββββββββββ
//Second DataFrame
βββββ€ββββββββββββββββββββ€ββββββββββββββββββββ€ββββββββββββββββββββ€ββββββββββββββββββββ
β β Key1 β Key2 β A β D β
βββββΌββββββββββββββββββββΌββββββββββββββββββββΌββββββββββββββββββββΌββββββββββββββββββββ’
β 0 β K0 β k0 β C0 β D0 β
βββββΌββββββββββββββββββββΌββββββββββββββββββββΌββββββββββββββββββββΌββββββββββββββββββββ’
β 1 β K1 β K0 β C1 β D1 β
βββββΌββββββββββββββββββββΌββββββββββββββββββββΌββββββββββββββββββββΌββββββββββββββββββββ’
β 2 β K1 β K0 β C2 β D2 β
βββββΌββββββββββββββββββββΌββββββββββββββββββββΌββββββββββββββββββββΌββββββββββββββββββββ’
β 3 β K2 β K0 β C3 β D3 β
βββββ§ββββββββββββββββββββ§ββββββββββββββββββββ§ββββββββββββββββββββ§ββββββββββββββββββββ
//After outer join
βββββ€ββββββββββββββββββββ€ββββββββββββββββββββ€ββββββββββββββββββββ€ββββββββββββββββββββ€ββββββββββββββββββββ€ββββββββββββββββββββ€ββββββββββββββββββββ
β β Key1 β Key2 β A β B β Key2_1 β A_1 β D β
βββββΌββββββββββββββββββββΌββββββββββββββββββββΌββββββββββββββββββββΌββββββββββββββββββββΌββββββββββββββββββββΌββββββββββββββββββββΌββββββββββββββββββββ’
β 0 β K0 β k0 β A0 β B0 β k0 β C0 β D0 β
βββββΌββββββββββββββββββββΌββββββββββββββββββββΌββββββββββββββββββββΌββββββββββββββββββββΌββββββββββββββββββββΌββββββββββββββββββββΌββββββββββββββββββββ’
β 1 β k0 β K1 β A1 β B1 β NaN β NaN β NaN β
βββββΌββββββββββββββββββββΌββββββββββββββββββββΌββββββββββββββββββββΌββββββββββββββββββββΌββββββββββββββββββββΌββββββββββββββββββββΌββββββββββββββββββββ’
β 2 β K1 β K0 β A2 β B2 β K0 β C1 β D1 β
βββββΌββββββββββββββββββββΌββββββββββββββββββββΌββββββββββββββββββββΌββββββββββββββββββββΌββββββββββββββββββββΌββββββββββββββββββββΌββββββββββββββββββββ’
β 3 β K1 β K0 β A2 β B2 β K0 β C2 β D2 β
βββββΌββββββββββββββββββββΌββββββββββββββββββββΌββββββββββββββββββββΌββββββββββββββββββββΌββββββββββββββββββββΌββββββββββββββββββββΌββββββββββββββββββββ’
β 4 β K2 β K2 β A3 β B3 β K0 β C3 β D3 β
βββββ§ββββββββββββββββββββ§ββββββββββββββββββββ§ββββββββββββββββββββ§ββββββββββββββββββββ§ββββββββββββββββββββ§ββββββββββββββββββββ§ββββββββββββββββββββ
{% endtab %} {% endtabs %}
{% tabs %} {% tab title="Node" %}
const dfd = require("danfojs-node")
let data = [['K0', 'k0', 'A0', 'B0'], ['k0', 'K1', 'A1', 'B1'],
['K1', 'K0', 'A2', 'B2'], ['K2', 'K2', 'A3', 'B3']]
let data2 = [['K0', 'k0', 'C0', 'D0'], ['K1', 'K0', 'C1', 'D1'],
['K1', 'K0', 'C2', 'D2'], ['K2', 'K0', 'C3', 'D3']]
let colum1 = ['Key1', 'Key2', 'A', 'B']
let colum2 = ['Key1', 'Key2', 'A', 'D']
let df1 = new dfd.DataFrame(data, { columns: colum1 })
let df2 = new dfd.DataFrame(data2, { columns: colum2 })
df1.print()
df2.print()
let merge_df = dfd.merge({ left: df1, right: df2,
on: ["Key1", "Key2"], how: "left"})
merge_df.print()
{% endtab %}
{% tab title="Browser" %}
{% endtab %} {% endtabs %}
{% tabs %} {% tab title="Output" %}
//first DataFrame
βββββ€ββββββββββββββββββββ€ββββββββββββββββββββ€ββββββββββββββββββββ€ββββββββββββββββββββ
β β Key1 β Key2 β A β B β
βββββΌββββββββββββββββββββΌββββββββββββββββββββΌββββββββββββββββββββΌββββββββββββββββββββ’
β 0 β K0 β k0 β A0 β B0 β
βββββΌββββββββββββββββββββΌββββββββββββββββββββΌββββββββββββββββββββΌββββββββββββββββββββ’
β 1 β k0 β K1 β A1 β B1 β
βββββΌββββββββββββββββββββΌββββββββββββββββββββΌββββββββββββββββββββΌββββββββββββββββββββ’
β 2 β K1 β K0 β A2 β B2 β
βββββΌββββββββββββββββββββΌββββββββββββββββββββΌββββββββββββββββββββΌββββββββββββββββββββ’
β 3 β K2 β K2 β A3 β B3 β
βββββ§ββββββββββββββββββββ§ββββββββββββββββββββ§ββββββββββββββββββββ§ββββββββββββββββββββ
//second DataFrame
βββββ€ββββββββββββββββββββ€ββββββββββββββββββββ€ββββββββββββββββββββ€ββββββββββββββββββββ
β β Key1 β Key2 β A β D β
βββββΌββββββββββββββββββββΌββββββββββββββββββββΌββββββββββββββββββββΌββββββββββββββββββββ’
β 0 β K0 β k0 β C0 β D0 β
βββββΌββββββββββββββββββββΌββββββββββββββββββββΌββββββββββββββββββββΌββββββββββββββββββββ’
β 1 β K1 β K0 β C1 β D1 β
βββββΌββββββββββββββββββββΌββββββββββββββββββββΌββββββββββββββββββββΌββββββββββββββββββββ’
β 2 β K1 β K0 β C2 β D2 β
βββββΌββββββββββββββββββββΌββββββββββββββββββββΌββββββββββββββββββββΌββββββββββββββββββββ’
β 3 β K2 β K0 β C3 β D3 β
βββββ§ββββββββββββββββββββ§ββββββββββββββββββββ§ββββββββββββββββββββ§ββββββββββββββββββββ
After left join
βββββ€ββββββββββββββββββββ€ββββββββββββββββββββ€ββββββββββββββββββββ€ββββββββββββββββββββ€ββββββββββββββββββββ€ββββββββββββββββββββ
β β Key1 β Key2 β A β B β A_1 β D β
βββββΌββββββββββββββββββββΌββββββββββββββββββββΌββββββββββββββββββββΌββββββββββββββββββββΌββββββββββββββββββββΌββββββββββββββββββββ’
β 0 β K0 β k0 β A0 β B0 β C0 β D0 β
βββββΌββββββββββββββββββββΌββββββββββββββββββββΌββββββββββββββββββββΌββββββββββββββββββββΌββββββββββββββββββββΌββββββββββββββββββββ’
β 1 β k0 β K1 β A1 β B1 β NaN β NaN β
βββββΌββββββββββββββββββββΌββββββββββββββββββββΌββββββββββββββββββββΌββββββββββββββββββββΌββββββββββββββββββββΌββββββββββββββββββββ’
β 2 β K1 β K0 β A2 β B2 β C1 β D1 β
βββββΌββββββββββββββββββββΌββββββββββββββββββββΌββββββββββββββββββββΌββββββββββββββββββββΌββββββββββββββββββββΌββββββββββββββββββββ’
β 3 β K1 β K0 β A2 β B2 β C2 β D2 β
βββββΌββββββββββββββββββββΌββββββββββββββββββββΌββββββββββββββββββββΌββββββββββββββββββββΌββββββββββββββββββββΌββββββββββββββββββββ’
β 4 β K2 β K2 β A3 β B3 β NaN β NaN β
βββββ§ββββββββββββββββββββ§ββββββββββββββββββββ§ββββββββββββββββββββ§ββββββββββββββββββββ§ββββββββββββββββββββ§ββββββββββββββββββββ
{% endtab %} {% endtabs %}
{% tabs %} {% tab title="Node" %}
const dfd = require("danfojs-node")
let data = [['K0', 'k0', 'A0', 'B0'], ['k0', 'K1', 'A1', 'B1'],
['K1', 'K0', 'A2', 'B2'], ['K2', 'K2', 'A3', 'B3']]
let data2 = [['K0', 'k0', 'C0', 'D0'], ['K1', 'K0', 'C1', 'D1'],
['K1', 'K0', 'C2', 'D2'], ['K2', 'K0', 'C3', 'D3']]
let colum1 = ['Key1', 'Key2', 'A', 'B']
let colum2 = ['Key1', 'Key2', 'A', 'D']
let df1 = new dfd.DataFrame(data, { columns: colum1 })
let df2 = new dfd.DataFrame(data2, { columns: colum2 })
df1.print()
df2.print()
let merge_df = dfd.merge({ left: df1, right: df2,
on: ["Key1", "Key2"], how: "right"})
merge_df.print()
{% endtab %}
{% tab title="Browser" %}
{% endtab %} {% endtabs %}
{% tabs %} {% tab title="Output" %}
//first DataFrame
βββββ€ββββββββββββββββββββ€ββββββββββββββββββββ€ββββββββββββββββββββ€ββββββββββββββββββββ
β β Key1 β Key2 β A β B β
βββββΌββββββββββββββββββββΌββββββββββββββββββββΌββββββββββββββββββββΌββββββββββββββββββββ’
β 0 β K0 β k0 β A0 β B0 β
βββββΌββββββββββββββββββββΌββββββββββββββββββββΌββββββββββββββββββββΌββββββββββββββββββββ’
β 1 β k0 β K1 β A1 β B1 β
βββββΌββββββββββββββββββββΌββββββββββββββββββββΌββββββββββββββββββββΌββββββββββββββββββββ’
β 2 β K1 β K0 β A2 β B2 β
βββββΌββββββββββββββββββββΌββββββββββββββββββββΌββββββββββββββββββββΌββββββββββββββββββββ’
β 3 β K2 β K2 β A3 β B3 β
βββββ§ββββββββββββββββββββ§ββββββββββββββββββββ§ββββββββββββββββββββ§ββββββββββββββββββββ
//second DataFrame
βββββ€ββββββββββββββββββββ€ββββββββββββββββββββ€ββββββββββββββββββββ€ββββββββββββββββββββ
β β Key1 β Key2 β A β D β
βββββΌββββββββββββββββββββΌββββββββββββββββββββΌββββββββββββββββββββΌββββββββββββββββββββ’
β 0 β K0 β k0 β C0 β D0 β
βββββΌββββββββββββββββββββΌββββββββββββββββββββΌββββββββββββββββββββΌββββββββββββββββββββ’
β 1 β K1 β K0 β C1 β D1 β
βββββΌββββββββββββββββββββΌββββββββββββββββββββΌββββββββββββββββββββΌββββββββββββββββββββ’
β 2 β K1 β K0 β C2 β D2 β
βββββΌββββββββββββββββββββΌββββββββββββββββββββΌββββββββββββββββββββΌββββββββββββββββββββ’
β 3 β K2 β K0 β C3 β D3 β
βββββ§ββββββββββββββββββββ§ββββββββββββββββββββ§ββββββββββββββββββββ§ββββββββββββββββββββ
//after right join
βββββ€ββββββββββββββββββββ€ββββββββββββββββββββ€ββββββββββββββββββββ€ββββββββββββββββββββ€ββββββββββββββββββββ€ββββββββββββββββββββ
β β Key1 β Key2 β A β B β A_1 β D β
βββββΌββββββββββββββββββββΌββββββββββββββββββββΌββββββββββββββββββββΌββββββββββββββββββββΌββββββββββββββββββββΌββββββββββββββββββββ’
β 0 β K0 β k0 β A0 β B0 β C0 β D0 β
βββββΌββββββββββββββββββββΌββββββββββββββββββββΌββββββββββββββββββββΌββββββββββββββββββββΌββββββββββββββββββββΌββββββββββββββββββββ’
β 1 β K1 β K0 β A2 β B2 β C1 β D1 β
βββββΌββββββββββββββββββββΌββββββββββββββββββββΌββββββββββββββββββββΌββββββββββββββββββββΌββββββββββββββββββββΌββββββββββββββββββββ’
β 2 β K1 β K0 β A2 β B2 β C2 β D2 β
βββββΌββββββββββββββββββββΌββββββββββββββββββββΌββββββββββββββββββββΌββββββββββββββββββββΌββββββββββββββββββββΌββββββββββββββββββββ’
β 3 β K2 β K0 β NaN β NaN β C3 β D3 β
βββββ§ββββββββββββββββββββ§ββββββββββββββββββββ§ββββββββββββββββββββ§ββββββββββββββββββββ§ββββββββββββββββββββ§ββββββββββββββββββββ
{% endtab %} {% endtabs %}
{% hint style="info" %} See also danfo.concat for joining objects based on axis. {% endhint %}