File size: 2,458 Bytes
bb3e610
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
import pandas as pd
import numpy as np
import random
def create_mock_data_heatmap():
    # ๊ธฐ๋ณธ ๊ตฌ์กฐ ์ƒ์„ฑ
    sections = [f'๊ตฌ์—ญ {i}' for i in range(1, 7)]
    months = list(range(1, 13))
    years = list(range(2020, 2025))
    
    # ๋ฐ์ดํ„ฐํ”„๋ ˆ์ž„์šฉ ๋ฆฌ์ŠคํŠธ ์ƒ์„ฑ
    data = []
    for year in years:
        for section in sections:
            for month in months:
                data.append({
                    'section': section,
                    'month': month,
                    'year': year,
                    'crowd_count': np.random.randint(30000, 500000)
                })
    
    # DataFrame ์ƒ์„ฑ
    df = pd.DataFrame(data)
    return df

def create_mock_data_table():
    mock_data = {
    'section': [f'๊ตฌ์—ญ {i}' for i in range(1, 7)],
    'count': np.random.randint(10000, 300000, 6)  
}

    df = pd.DataFrame(mock_data)
    return df

def create_mock_data_donut(min_value=10000, max_value=500000):
    """
    ๊ฐ€์ƒ์˜ ์ธ๊ตฌ ์ด๋™ ๋ฐ์ดํ„ฐ๋ฅผ ์ƒ์„ฑํ•ฉ๋‹ˆ๋‹ค.
    
    Returns:
        tuple: (์ธ๋ฐ”์šด๋“œ ์ด๋™ ๋น„์œจ, ์•„์›ƒ๋ฐ”์šด๋“œ ์ด๋™ ๋น„์œจ)
    """
    # ๋žœ๋ค ๊ฐ’ ์ƒ์„ฑ (10000~500000 ์‚ฌ์ด)
    inbound = random.randint(min_value, max_value)
    outbound = random.randint(min_value, max_value)
    
    # ์ „์ฒด ๊ฐ’ ๋Œ€๋น„ ๋น„์œจ ๊ณ„์‚ฐ (0-100 ์‚ฌ์ด์˜ ๊ฐ’์œผ๋กœ ๋ณ€ํ™˜)
    total = inbound + outbound
    inbound_percent = round((inbound / total) * 100)
    outbound_percent = round((outbound / total) * 100)
    
    return inbound_percent, outbound_percent


def create_mock_data_inout():
    """
    ๋ฐฉ๋ฌธ๊ฐ ๋ฐ์ดํ„ฐ ๋žœ๋ค ์ƒ์„ฑ
    - ์ด๋ฒˆ๋‹ฌ ๋ฐฉ๋ฌธ๊ฐ: 150,000 ~ 500,000
    - ์˜ค๋Š˜ ๋ฐฉ๋ฌธ๊ฐ: 5,000 ~ 100,000
    - delta๋Š” ์ „์›”/์ „์ผ ๋Œ€๋น„ ์ฆ๊ฐ๋Ÿ‰ (-30% ~ +30%)
    """
    # ์ด๋ฒˆ๋‹ฌ ๋ฐฉ๋ฌธ๊ฐ (๋” ํฐ ๋ฒ”์œ„)
    monthly_visitors = random.randint(150000, 500000)
    monthly_delta = int(monthly_visitors * random.uniform(-0.3, 0.3))  # 30% ๋ฒ”์œ„ ๋‚ด ์ฆ๊ฐ
    
    # ์˜ค๋Š˜ ๋ฐฉ๋ฌธ๊ฐ (๋” ์ž‘์€ ๋ฒ”์œ„)
    daily_visitors = random.randint(5000, 100000)
    daily_delta = int(daily_visitors * random.uniform(-0.3, 0.3))  # 30% ๋ฒ”์œ„ ๋‚ด ์ฆ๊ฐ
    
    return {
        'top': {
            'state': '์ด๋ฒˆ๋‹ฌ ๋ฐฉ๋ฌธ๊ฐ',
            'visitor': monthly_visitors,
            'delta': monthly_delta
        },
        'bottom': {
            'state': '์˜ค๋Š˜ ๋ฐฉ๋ฌธ๊ฐ',
            'visitor': daily_visitors,
            'delta': daily_delta
        }
    }