Spaces:
Runtime error
Runtime error
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
}
} |