

피벗테이블
1) index
- pd.pivot_table(df, index=["Name"])
- pd.pivot_table(df, index=["Name","Rep","Manager"])
2) index, values
- pd.pivot_table(df, index=["Name"], values=["Price"])
(평균이 디폴트)
3) index, values, aggfunc
- pd.pivot_table(df, index=["Name"], values=["Price"], aggfunc=np.sum)
- pd.pivot_table(df, index=["Name"], values=["Price"], aggfunc=[np.sum, len])
(len : 개수)
4) index, values, aggfunc, columns
(columns : 분류 지정)
- pd.pivot_table(df, index=["Name", "Rep"], values=["Price"], columns=["Product"], aggfunc=[np.sum])
5) index, values, aggfunc, columns, fill_value
- pd.pivot_table(df, index=["Name", "Rep"], values=["Price"], columns=["Product"], aggfunc=[np.sum], fill_value=0)
6) pivot(인덱스, 열, value)
- flights = flights.pivot("month","year","passengers")
7) 다중컬럼
crime_station.columns = crime_station.columns.droplevel([0,1])
crime_station.columns.get_level_values(0)


