Pandas/Merging & reshaping 9 min
Merging and reshaping
Joins, pivots and melts.
mergepivot_tablemelt
merge is the pandas join: name the key and the kind of join you want. left keeps every row on the left, inner keeps only matches.
python · editable
loading editor…
pivot_table reshapes long data into a matrix, aggregating duplicates as it goes.
python · editable
loading editor…
melt does the reverse, turning wide columns back into rows.
python · editable
loading editor…
practice this