[LeetCode] Pandas / 2890. Reshape data: Melt
2024. 7. 8. 15:08ㆍCoding/LeetCode-Pandas
문제 링크
https://leetcode.com/problems/reshape-data-melt/description/
문제
코드
import pandas as pd
def meltTable(report: pd.DataFrame) -> pd.DataFrame:
return report.melt(id_vars=['product'], var_name='quarter', value_name='sales')
'Coding > LeetCode-Pandas' 카테고리의 다른 글
[LeetCode] Pandas / 2891. Method Chaining (0) | 2024.07.08 |
---|---|
[LeetCode] Pandas / 2889. Reshape data: Pivot (0) | 2024.07.08 |
[LeetCode] Pandas / 2888. Reshape data concatenate (0) | 2024.07.08 |
[LeetCode] Pandas / 2887. Fill missing data (0) | 2024.07.08 |
[LeetCode] Pandas / 2886. Change data type (0) | 2024.07.08 |