import pandas as pd
# 데이터프레임 생성
= pd.DataFrame({
df 'Year': [2020, 2020, 2020, 2020, 2021, 2021, 2021, 2021],
'Product': ['Product_A', 'Product_A', 'Product_B', 'Product_B',
'Product_A', 'Product_A', 'Product_B', 'Product_B'],
'Region': ['North', 'South', 'North', 'South',
'North', 'South', 'North', 'South'],
'Sales': [100, 120, 150, 130, 110, 140, 160, 150]
}) df
Year | Product | Region | Sales | |
---|---|---|---|---|
0 | 2020 | Product_A | North | 100 |
1 | 2020 | Product_A | South | 120 |
2 | 2020 | Product_B | North | 150 |
3 | 2020 | Product_B | South | 130 |
4 | 2021 | Product_A | North | 110 |
5 | 2021 | Product_A | South | 140 |
6 | 2021 | Product_B | North | 160 |
7 | 2021 | Product_B | South | 150 |