g2801_2900.s2890_reshape_data_melt.solution.py Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of leetcode-in-kotlin Show documentation
Show all versions of leetcode-in-kotlin Show documentation
Kotlin-based LeetCode algorithm problem solutions, regularly updated
# #Easy #2023_12_25_Time_446_ms_(97.89%)_Space_60.5_MB_(68.02%)
import pandas as pd
def meltTable(report: pd.DataFrame) -> pd.DataFrame:
return report.melt(id_vars='product', var_name='quarter', value_name='sales')