55 lines
2.3 KiB
Python
55 lines
2.3 KiB
Python
# This is a sample Python script.
|
|
import pandas
|
|
import matplotlib as mpl
|
|
import matplotlib.pyplot as plt
|
|
import base64
|
|
|
|
font_name = mpl.font_manager.FontProperties(fname='/Users/maddiekorea/Library/Fonts/NotoSansCJKkr-Light.otf').get_name()
|
|
mpl.rc('font', family=font_name)
|
|
|
|
# Press ⌃R to execute it or replace it with your code.
|
|
# Press Double ⇧ to search everywhere for classes, files, tool windows, actions, and settings.
|
|
|
|
# Press the green button in the gutter to run the script.
|
|
if __name__ == '__main__':
|
|
df = pandas.read_excel("./newuserconv_2022.xlsx")
|
|
xaxis = df.index.to_list()
|
|
jasonapp019_join = df['(공)가입자수'].to_list()
|
|
jasonapp019_order = df['(공)주문인수'].to_list()
|
|
jasonapp018_join = df['(심)가입자수'].to_list()
|
|
jasonapp018_order = df['(심)주문인수'].to_list()
|
|
jasonapp014_join = df['(할)가입자수'].to_list()
|
|
jasonapp014_order = df['(할)주문인수'].to_list()
|
|
plt.figure(figsize=(10, 8))
|
|
plt.subplot(3, 1, 1)
|
|
plt.title('2022년 신규 가입자 및 당일 전환 추이')
|
|
plt.plot(xaxis, jasonapp019_join, 'o-', ms=2, lw=1, label='가입수')
|
|
plt.plot(xaxis, jasonapp019_order, 'o-', ms=2, lw=1, label='당일전환주문수')
|
|
# plt.yscale('log')
|
|
plt.legend()
|
|
plt.ylabel('공구마켓')
|
|
plt.subplot(3, 1, 2)
|
|
plt.plot(xaxis, jasonapp018_join, 'o-', ms=2, lw=1, label='가입수')
|
|
plt.plot(xaxis, jasonapp018_order, 'o-', ms=2, lw=1, label='당일전환주문수')
|
|
#plt.yscale('log')
|
|
plt.ylabel('심쿵할인')
|
|
plt.subplot(3, 1, 3)
|
|
plt.plot(xaxis, jasonapp014_join, 'o-', ms=2, lw=1, label='가입수')
|
|
plt.plot(xaxis, jasonapp014_order, 'o-', ms=2, lw=1, label='당일전환주문수')
|
|
#plt.yscale('log')
|
|
plt.ylabel('할인중독')
|
|
plt.xlabel('day (s)')
|
|
#plt.show()
|
|
plt.savefig('./trends.png')
|
|
|
|
img = open('./trends.png', 'rb')
|
|
base64_string = base64.encodebytes(img.read())
|
|
res = "data:image/png;base64," + base64_string.decode()
|
|
|
|
print("<img src=\"" + res + "\" />")
|
|
|
|
#plt.plot(x='일자',y=['(공)가입자수','(공)주문인수'],logy=False, grid=True)
|
|
#plt.plot(x='일자',y=['(심)가입자수', '(심)주문인수'], logy=False, grid=True)
|
|
#plt.plot(x='일자',y=['(할)가입자수', '(할)주문인수'], logy=False, grid=True)
|
|
|