File size: 5,890 Bytes
86f5e7c
 
 
 
 
 
 
 
 
 
 
 
4cdd5a4
86f5e7c
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
import streamlit as st
import pandas as pd
import matplotlib.pyplot as plt
import pandas_bokeh
import seaborn as sns

# ๊ธ€ ์“ฐ๊ธฐ(๋งํฌ ์‚ฝ์ž…)
st.title('VIETNAM DONGDAEMUN FOOOOOOOOOD!!!!!!!!!')

st.header('Selection of Vietnamese Restaurants in Dongdaemun Area')
st.subheader('Variety of dishes from different region in Vietnam, made affordable and delicious for local taste')
st.subheader('Items such as Pho Soup, Bun Bo Hue, Cha Gio or Com Chien')
st.write('''Write something here about the booming of Vietnamese Restaurant in Korea - particularly the fast growing food scene in Dongdaemun [๋ฒ ํŠธ๋‚จ ์š”๋ฆฌ](https://namu.wiki/w/%EB%B2%A0%ED%8A%B8%EB%82%A8%20%EC%9A%94%EB%A6%AC)
.''' )

# ์‚ฌ์ง„ ์‚ฝ์ž…
st.image('final_image_2.jpg', caption='A Spread of Vietnamese Dishes You Might Be Able To Find')

st.image('final_image_4.jpg', caption='A popular choice everywhere: Vietnamese Pho Soup')

st.image('final_image_3.jpg', caption='Hidden Gem: Banh Xeo')


st.header('Cheap and Delicious: One can find a variety of Vietnamese Restaurant in Dongdaemun Area')
st.subheader('Hosting dishes from North to South Vietnam')
st.subheader('The almost infinite choices will leave you looking for reviews!')
st.write('''Before deciding on which dish you'd want ~ carefully browse through the Blog section for an intimate look at the local food joints''' )

# ๋ฐ์ดํ„ฐ ๋ณด์—ฌ์ฃผ๊ธฐ
df_๋™๋Œ€๋ฌธ๊ตฌ_๋ฒ ํŠธ๋‚จ_๋ง›์ง‘ = pd.read_excel('vietnam_food_dongdaemun_BLOGS.xlsx', index_col=0)
st.write('We have narrowed down to 150 most relevant blogs!!',df_๋™๋Œ€๋ฌธ๊ตฌ_๋ฒ ํŠธ๋‚จ_๋ง›์ง‘)

df_๋™๋Œ€๋ฌธ๊ตฌ_๋ฒ ํŠธ๋‚จ_๋ง›์ง‘_keyword = pd.read_excel('vietnam_food_KEYWORDS.xlsx', index_col=0)
st.write('๋ธ”๋กœ๊ทธ ๊ธ€์—์„œ ๊ฐ€์žฅ ๋งŽ์ด ์ถœํ˜„ํ•œ ๋‹จ์–ด๋Š” ~~~ ์„ค๋ช…~~~', df_๋™๋Œ€๋ฌธ๊ตฌ_๋ฒ ํŠธ๋‚จ_๋ง›์ง‘_keyword)



# ์›Œ๋“œํด๋ผ์šฐ๋“œ - WORDCLOUD
st.write('์ฃผ์š”  ๋‹จ์–ด๋“ค์„ ์›Œ๋“œํด๋ผ์šฐ๋“œ๋กœ ๋ณด์—ฌ์ฃผ๋ฉด ๋‹ค์Œ๊ณผ ๊ฐ™๋‹ค')
st.image('final_WORDCLOUD.png')



# ์—ฐ๊ฒฐ๋ง ๋ถ„์„ - NETWORK
st.write('''์ทจ์žฌํŒ€์€ ์ฃผ์š”  ๋‹จ์–ด๋“ค ๊ฐ„์— ๊ณต๋™์ถœํ˜„ํ•˜๋Š” ๊ด€๊ณ„๋ฅผ ๋ฐ”ํƒ•์œผ๋กœ ์˜๋ฏธ์—ฐ๊ฒฐ๋ง์„ ๊ทธ๋ ค๋ณด์•˜๋‹ค.
        ๋ถ„์„๊ฒฐ๊ณผ, ~~์„ค๋ช…~~''')
st.image('final_NETWORK.png')

#### The Section Below Is Extra Stuff We Gotta Think About

#
df_๋™๋Œ€๋ฌธ๊ตฌ_๋ฒ ํŠธ๋‚จ_๋ง›์ง‘_2 = pd.read_excel('vietnam_food_dongdaemun_BLOGS.xlsx', index_col=0)
st.write('Again, the list of blog posts on Dongdaemun Vietnamese Restaurant', df_๋™๋Œ€๋ฌธ๊ตฌ_๋ฒ ํŠธ๋‚จ_๋ง›์ง‘_2)

# ๊ฒ€์ƒ‰์–ด ์ž…๋ ฅ ๋ฐ›์•„ ์ถœ๋ ฅ
query = st.text_input('Enter Keyword such as: food name, restaurant name', key='region1_input')
df_๋™๋Œ€๋ฌธ๊ตฌ_๋ฒ ํŠธ๋‚จ_๋ง›์ง‘_2['select1']=df_๋™๋Œ€๋ฌธ๊ตฌ_๋ฒ ํŠธ๋‚จ_๋ง›์ง‘_2['text'].apply(lambda x: 1 if query in x else 0)
st.write('๊ฒ€์ƒ‰ ๊ฒฐ๊ณผ:', df_๋™๋Œ€๋ฌธ๊ตฌ_๋ฒ ํŠธ๋‚จ_๋ง›์ง‘_2[df_๋™๋Œ€๋ฌธ๊ตฌ_๋ฒ ํŠธ๋‚จ_๋ง›์ง‘_2['select1']==1])

##### HEATMAP #####

# Load the data from the Excel file
file_path = 'vietnam_food_by_month.xlsx'
final_df = pd.read_excel(file_path)

# Ensure the 'month' column is present
if 'month' not in final_df.columns:
    final_df['month'] = pd.to_datetime(final_df['date']).dt.month

# Count the number of blog posts per month
monthly_counts = final_df['month'].value_counts().sort_index()

# Prepare data for heatmap
heatmap_data = monthly_counts.reset_index()
heatmap_data.columns = ['Month', 'Number of Posts']
heatmap_data = heatmap_data.set_index('Month').T

# Streamlit application
st.title('Monthly Blog Posts about Vietnamese Food in Seoul (2023)')
st.write('Number of blog posts for each month:')
st.write(heatmap_data)

fig, ax = plt.subplots(figsize=(10, 6))
sns.heatmap(heatmap_data, annot=True, cmap='YlGnBu', ax=ax)
st.pyplot(fig)

# ๊ตํ†ต์‚ฌ๊ณ  ์œ ํ˜•๊ณผ ์—ฐ๋„์— ๋”ฐ๋ฅธ pivot table ๋ณด์—ฌ์ฃผ๊ธฐ
#df_๊ตํ†ต์‚ฌ๊ณ _pivot=df_๊ตํ†ต์‚ฌ๊ณ .pivot_table(index='์‚ฌ๊ณ ์œ ํ˜•๊ตฌ๋ถ„', columns='์‚ฌ๊ณ ์—ฐ๋„', values='์‚ฌ๊ณ ๊ฑด์ˆ˜', aggfunc='sum')
#df_๊ตํ†ต์‚ฌ๊ณ _heatmap=df_๊ตํ†ต์‚ฌ๊ณ _pivot.style.background_gradient(cmap='Oranges').format("{:.2f}")
#st.write('๋‹ค์Œ ํ‘œ๋Š” ๊ตํ†ต์‚ฌ๊ณ  ๊ฑด์ˆ˜๋ฅผ ์œ ํ˜•๊ณผ ์—ฐ๋„์— ๋”ฐ๋ผ ๊ตฌ๋ถ„ํ•œ ๊ฒƒ์ด๋‹ค', df_๊ตํ†ต์‚ฌ๊ณ _heatmap)

# ๊ฒ€์ƒ‰์–ด ์ž…๋ ฅ ๋ฐ›์•„ pivot table ์ถœ๋ ฅ
#query_pivot = st.text_input('์ด ๊ณณ์— ์ง€์—ญ๋ช…(์‹œ๊ตฐ๊ตฌ)์„ ์ž…๋ ฅํ•˜๋ฉด ๊ด€๋ จ ๋ฐ์ดํ„ฐ๋งŒ ๊ฒ€์ƒ‰ํ•ด ๋ณด์—ฌ์ค๋‹ˆ๋‹ค', key='region2_input')
#df_๊ตํ†ต์‚ฌ๊ณ ['select2']=df_๊ตํ†ต์‚ฌ๊ณ ['์‚ฌ๊ณ ์ง€์—ญ์œ„์น˜๋ช…'].apply(lambda x: 1 if query_pivot in x else 0)
#df_๊ตํ†ต์‚ฌ๊ณ _pivot_selected=df_๊ตํ†ต์‚ฌ๊ณ [df_๊ตํ†ต์‚ฌ๊ณ ['select2']==1].pivot_table(index='์‚ฌ๊ณ ์œ ํ˜•๊ตฌ๋ถ„', columns='์‚ฌ๊ณ ์—ฐ๋„', values='์‚ฌ๊ณ ๊ฑด์ˆ˜', aggfunc='sum')
#df_๊ตํ†ต์‚ฌ๊ณ _heatmap_selected=df_๊ตํ†ต์‚ฌ๊ณ _pivot_selected.style.background_gradient(cmap='Oranges').format("{:.2f}")
#st.write('๊ฒ€์ƒ‰ ๊ฒฐ๊ณผ:', df_๊ตํ†ต์‚ฌ๊ณ _heatmap_selected)

# pandas_bokeh ๊ทธ๋ž˜ํ”„ ๋ณด์—ฌ์ฃผ๊ธฐ
#st.write('์ „๊ตญ ๊ตํ†ต์‚ฌ๊ณ  ๋ฐ์ดํ„ฐ์— ๋”ฐ๋ฅด๋ฉด, ์‚ฌ๊ณ ๊ฑด์ˆ˜์™€ ์ค‘์ƒ์ž์ˆ˜๋Š” ๋ฐ€์ ‘ํ•œ ๊ด€๋ จ์„ ๋งบ๊ณ  ์žˆ๋‹ค. ~~~์„ค๋ช…~~. *๊ทธ๋ž˜ํ”„ ๋‚ด ์ ์— ์ปค์„œ๋ฅผ ๋Œ€๋ฉด ์ง€์—ญ๋ช…์ด ๋‚˜ํƒ€๋‚œ๋‹ค')
#p_scatter = df_๊ตํ†ต์‚ฌ๊ณ .plot_bokeh.scatter(
#    x="์‚ฌ๊ณ ๊ฑด์ˆ˜",
#    y="์ค‘์ƒ์ž์ˆ˜",
#    title="์‚ฌ๊ณ ๊ฑด์ˆ˜์™€ ์ค‘์ƒ์ž์ˆ˜",
#    size=10,
#    hovertool_string="""<h6>์œ„์น˜:@{์‚ฌ๊ณ ์ง€์—ญ์œ„์น˜๋ช…}</h6>"""
#)
#st.bokeh_chart(p_scatter, use_container_width=True)

# ์„ ํƒํ•œ ์กฐ๊ฑด์— ๋”ฐ๋ผ ์ถœ๋ ฅ
#option = st.selectbox('์—ฐ๋„๋ฅผ ์„ ํƒํ•˜๋ฉด ํ•ด๋‹น ์‹œ๊ธฐ์˜ ๊ทธ๋ž˜ํ”„๋ฅผ ๋ณด์—ฌ์ค๋‹ˆ๋‹ค',
#                 (2012, 2013, 2014, 2015, 2016, 2018, 2017, 2019, 2020, 2021), key='year_input')

#p_scatter_selected = df_๊ตํ†ต์‚ฌ๊ณ [df_๊ตํ†ต์‚ฌ๊ณ ['์‚ฌ๊ณ ์—ฐ๋„']==option].plot_bokeh.scatter(
#    x="์‚ฌ๊ณ ๊ฑด์ˆ˜",
#    y="์ค‘์ƒ์ž์ˆ˜",
#    title="์‚ฌ๊ณ ๊ฑด์ˆ˜์™€ ์ค‘์ƒ์ž์ˆ˜",
#    size=10,
#    hovertool_string="""<h6>์œ„์น˜:@{์‚ฌ๊ณ ์ง€์—ญ์œ„์น˜๋ช…}</h6>"""
#)
#st.write('๊ฒ€์ƒ‰ ๊ฒฐ๊ณผ:')
#st.bokeh_chart(p_scatter_selected, use_container_width=True)