GDP.csv
province,2016y,2015y,2014y,2013y,2012y,2011y,2010y,2009y,2008y,2007y,2006y,2005y,2004y,2003y,2002y,2001y,2000y,1999y,1998y,1997y
北京市,25669.13,23014.59,21330.83,19800.81,17879.4,16251.93,14113.58,12153.03,11115,9846.81,8117.78,6969.52,6033.21,5007.21,4315,3707.96,3161.66,2678.82,2377.18,2077.09
天津市,17885.39,16538.19,15726.93,14442.01,12893.88,11307.28,9224.46,7521.85,6719.01,5252.76,4462.74,3905.64,3110.97,2578.03,2150.76,1919.09,1701.88,1500.95,1374.6,1264.63
河北省,32070.45,29806.11,29421.15,28442.95,26575.01,24515.76,20394.26,17235.48,16011.97,13607.32,11467.6,10012.11,8477.63,6921.29,6018.28,5516.76,5043.96,4514.19,4256.01,3953.78
山西省,13050.41,12766.49,12761.49,12665.25,12112.83,11237.55,9200.86,7358.31,7315.4,6024.45,4878.61,4230.53,3571.37,2855.23,2324.8,2029.53,1845.72,1667.1,1611.08,1476
内蒙古,18128.1,17831.51,17770.19,16916.5,15880.58,14359.88,11672,9740.25,8496.2,6423.18,4944.25,3905.03,3041.07,2388.38,1940.94,1713.81,1539.12,1379.31,1262.54,1153.51
辽宁省,22246.9,28669.02,28626.58,27213.22,24846.43,22226.7,18457.27,15212.49,13668.58,11164.3,9304.52,8047.26,6672,6002.54,5458.22,5033.08,4669.06,4171.69,3881.73,3582.46
吉林省,14776.8,14063.13,13803.14,13046.4,11939.24,10568.83,8667.58,7278.75,6426.1,5284.69,4275.12,3620.27,3122.01,2662.08,2348.54,2120.35,1951.51,1672.96,1577.05,1464.34
黑龙江省,15386.09,15083.67,15039.38,14454.91,13691.58,12582,10368.6,8587,8314.37,7104,6211.8,5513.7,4750.6,4057.4,3637.2,3390.1,3151.4,2866.3,2774.4,2667.5
上海市,28178.65,25123.45,23567.7,21818.15,20181.72,19195.69,17165.98,15046.45,14069.86,12494.01,10572.24,9247.66,8072.83,6694.23,5741.03,5210.12,4771.17,4188.73,3801.09,3438.79
江苏省,77388.28,70116.38,65088.32,59753.37,54058.22,49110.27,41425.48,34457.3,30981.98,26018.48,21742.05,18598.69,15003.6,12442.87,10606.85,9456.84,8553.69,7697.82,7199.95,6680.34
浙江省,47251.36,42886.49,40173.03,37756.59,34665.33,32318.85,27722.31,22990.35,21462.69,18753.73,15718.47,13417.68,11648.7,9705.02,8003.67,6898.34,6141.03,5443.92,5052.62,4686.11
安徽省,24407.62,22005.63,20848.75,19229.34,17212.05,15300.65,12359.33,10062.82,8851.66,7360.92,6112.5,5350.17,4759.3,3923.11,3519.72,3246.71,2902.09,2712.34,2542.96,2347.32
福建省,28810.58,25979.82,24055.76,21868.49,19701.78,17560.18,14737.12,12236.53,10823.01,9248.53,7583.85,6554.69,5763.35,4983.67,4467.55,4072.85,3764.54,3414.19,3159.91,2870.9
江西省,18499,16723.78,15714.63,14410.19,12948.88,11702.82,9451.26,7655.18,6971.05,5800.25,4820.53,4056.76,3456.7,2807.41,2450.48,2175.68,2003.07,1853.65,1719.87,1605.77
山东省,68024.49,63002.33,59426.59,55230.32,50013.24,45361.85,39169.92,33896.65,30933.28,25776.91,21900.19,18366.87,15021.84,12078.15,10275.5,9195.04,8337.47,7493.84,7021.35,6537.07
河南省,40471.79,37002.16,34938.24,32191.3,29599.31,26931.03,23092.36,19480.46,18018.53,15012.46,12362.79,10587.42,8553.79,6867.7,6035.48,5533.01,5052.99,4517.94,4308.24,4041.09
湖北省,32665.38,29550.19,27379.22,24791.83,22250.45,19632.26,15967.61,12961.1,11328.92,9333.4,7617.47,6590.19,5633.24,4757.45,4212.82,3880.53,3545.39,3229.29,3114.02,2856.47
湖南省,31551.37,28902.21,27037.32,24621.67,22154.23,19669.56,16037.96,13059.69,11555,9439.6,7688.67,6596.1,5641.94,4659.99,4151.54,3831.9,3551.49,3214.54,3025.53,2849.27
广东省,80854.91,72812.55,67809.85,62474.79,57067.92,53210.28,46013.06,39482.56,36796.71,31777.01,26587.76,22557.37,18864.62,15844.64,13502.42,12039.25,10741.25,9250.68,8530.88,7774.53
广西,18317.64,16803.12,15672.89,14449.9,13035.1,11720.87,9569.85,7759.16,7021,5823.41,4746.16,3984.1,3433.5,2821.11,2523.73,2279.34,2080.04,1971.41,1911.3,1817.25
海南省,4053.2,3702.76,3500.72,3177.56,2855.54,2522.66,2064.5,1654.21,1503.06,1254.17,1065.67,918.75,819.66,713.96,642.73,579.17,526.82,476.67,442.13,411.16
重庆市,17740.59,15717.27,14262.6,12783.26,11409.6,10011.37,7925.58,6530.01,5793.66,4676.13,3907.23,3467.72,3034.58,2555.72,2232.86,1976.86,1791,1663.2,1602.38,1509.75
四川省,32934.54,30053.1,28536.66,26392.07,23872.8,21026.68,17185.48,14151.28,12601.23,10562.39,8690.24,7385.1,6379.63,5333.09,4725.01,4293.49,3928.2,3649.12,3474.09,3241.47
贵州省,11776.73,10502.56,9266.39,8086.86,6852.2,5701.84,4602.16,3912.68,3561.56,2884.11,2338.98,2005.42,1677.8,1426.34,1243.43,1133.27,1029.92,937.5,858.39,805.79
云南省,14788.42,13619.17,12814.59,11832.31,10309.47,8893.12,7224.18,6169.75,5692.12,4772.52,3988.14,3462.73,3081.91,2556.02,2312.82,2138.31,2011.19,1899.82,1831.33,1676.17
西藏,1151.41,1026.39,920.83,815.67,701.03,605.83,507.46,441.36,394.85,341.43,290.76,248.8,220.34,185.09,162.04,139.16,117.8,105.98,91.5,77.24
陕西省,19399.59,18021.86,17689.94,16205.45,14453.68,12512.3,10123.48,8169.8,7314.58,5757.29,4743.61,3933.72,3175.58,2587.72,2253.39,2010.62,1804,1592.64,1458.4,1363.6
甘肃省,7200.37,6790.32,6836.82,6330.69,5650.2,5020.37,4120.75,3387.56,3166.82,2703.98,2277.35,1933.98,1688.49,1399.83,1232.03,1125.37,1052.88,956.32,887.67,793.57
青海省,2572.49,2417.05,2303.32,2122.06,1893.54,1670.44,1350.43,1081.27,1018.62,797.35,648.5,543.32,466.1,390.2,340.65,300.13,263.68,239.38,220.92,202.79
宁夏,3168.59,2911.77,2752.1,2577.57,2341.29,2102.21,1689.65,1353.31,1203.92,919.11,725.9,612.61,537.11,445.36,377.16,337.44,295.02,264.58,245.44,224.59
新疆,9649.7,9324.8,9273.46,8443.84,7505.31,6610.05,5437.47,4277.05,4183.21,3523.16,3045.26,2604.19,2209.09,1886.35,1612.65,1491.6,1363.56,1163.17,1106.95,1039.85
线图 Y轴log效果,设置每个省使用的点用不同形状,数据紧贴Y轴。横向zoom缩放条在下方,滑块靠左。
"""
线图 + zoom滑块在左侧, logY效果
线图 Y轴log效果,设置每个省使用的点用不同形状,数据紧贴Y轴。横向zoom缩放条在下方,滑块靠左。
"""
import pandas as pd
import numpy as np
from pyecharts.charts import Line
from pyecharts import options as opts
df = pd.read_csv('gdp.csv')
d = df.iloc[[0,14,18,15,19,27],0:].set_index("province")
d = d.T.sort_index()
x = d.index.tolist() #X轴
y = np.array(d.T) #Y轴
City = d.columns.values.tolist() #城市
symbol=['circle','rect','roundRect','triangle','diamond', 'pin', 'arrow']
#线图 左滑块orient='vertical'
def show_line():
line = Line().add_xaxis(x)
for i in range(len(City)):
line.add_yaxis(City[i],list(y[i]),is_smooth=True,symbol=symbol[i],symbol_size=10)
line.set_global_opts(title_opts=opts.TitleOpts(title="线性滑块"),
xaxis_opts=opts.AxisOpts(
axistick_opts=opts.AxisTickOpts(is_align_with_label=True),
is_scale=False,
boundary_gap=False,
),
datazoom_opts=opts.DataZoomOpts(pos_left = True,range_start=0),
yaxis_opts=opts.AxisOpts(type_="log",is_scale=True))
return line
show_line().render_notebook()
(1)Timeline轮播: 横向柱状图, 按GDP排序,值大的在上,轮播年份
#GDP数据取 北京、山东、广东、河南、广西、甘肃 六个省,所有年份
#(1)Timeline轮播: 横向柱状图, 按GDP排序,值大的在上,轮播年份
import pandas as pd
from pyecharts import options as opts
from pyecharts.charts import *
#获取数据
data = pd.read_csv(r'gdp.csv')
#print(data)
data=data.set_index('province')
#print(data)
lieming=data.columns.tolist()
#print(lieming)
def timeline_bar1() -> Timeline:
city=['北京市','山东省','广东省','河南省','广西','甘肃省']
t1 = Timeline()
for i in lieming:
city =data.loc[['北京市','山东省','广东省','河南省','广西','甘肃省'],:].sort_values(i).index.values.tolist()
year1=data.loc[['北京市','山东省','广东省','河南省','广西','甘肃省'],:].sort_values(i)[i].values.tolist()
bar = (
Bar()
.add_xaxis(city)#每次添加一样的X轴
.add_yaxis("GDP",year1)
.set_global_opts(title_opts=opts.TitleOpts("GDP{}".format(i)))
.reversal_axis()
)
t1.add(bar, "{}".format(i))
return t1
timeline_bar1().render_notebook()
启动metabase
java -jar metabase.jar
导入好的数据库
select tt.name,count(category_id) as '总数'
from
(
select category.name,film_category.film_id,film_category.category_id
from film_category
left join category ON film_category.`category_id` = category.`category_id`
) as tt
group by category_id;