Notice
Recent Posts
Recent Comments
Link
라일락 꽃이 피는 날
[Pandas] melt 본문
728x90
melt
기준이 되는 변수를 선택해서 지정하고, 그 변수를 기준으로 컬럼을 행으로 재구조화시키는 함수다.
pandas.melt(frame, id_vars=[], value_vars=[])
id_vars : 기준이 되는 변수
value_vars : 행으로 대입할 변수들
https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.melt.html
pandas.melt — pandas 1.2.4 documentation
If True, original index is ignored. If False, the original index is retained. Index labels will be repeated as necessary.
pandas.pydata.org
df_cat

df_cat_melt = pd.melt(df_cat, id_vars=['category'], value_vars=['order_cnt_perc', 'order_amount_perc'])
df_cat_melt

728x90
'데이터 분석 > Python' 카테고리의 다른 글
| [Numpy] ndarray 생성 (0) | 2021.06.16 |
|---|---|
| [Numpy] 기본 함수 (0) | 2021.06.16 |
| [Numpy] concatenate, split (0) | 2021.06.14 |
| 텍스트 마이닝 2 (0) | 2021.06.04 |
| Folium (0) | 2021.06.04 |