Spreadsheets often store one column per metric per year: sales_2022, sales_2023, cost_2022, … That's awkward to analyse. Tidy data has one row per observation.
Implement to_long(df, id_col): turn every column named <metric>_<year> into rows with columns id_col, year (int) and one column per metric. Sort by id_col, then year, with a fresh index. Metric columns should be ordered alphabetically after year. A missing combination becomes NaN.
Then implement to_wide(long_df, id_col), the inverse, with columns id_col followed by <metric>_<year> sorted by metric then year.