当前位置: 首页 > news >正文

政府网站建设公司抖音seo是什么意思

政府网站建设公司,抖音seo是什么意思,装一网装修平台官网,中国企业联合会大家好,数据可视化动画使用Python包就可以完成,效果如下:想要使用Pynimate,直接import一下就行:import pynimate as nim输入数据后,Pynimate将使用函数Barplot()来创建条形数据动画。…

大家好,数据可视化动画使用Python包就可以完成,效果如下:

想要使用Pynimate,直接import一下就行:

import pynimate as nim

输入数据后,Pynimate将使用函数Barplot()来创建条形数据动画。

而创建这种动画,输入的数据必须是pandas数据结构(如下),其中将时间列设置为索引,换句话说索引代表的是自变量。

time, col1, col2, col3
2012   1     2     1
2013   1     1     2
2014   2     1.5   3
2015   2.5   2     3.5

具体的代码形式如下:

import pandas as pd
df = pd.read_csv('data'csv').set_index('time')

比如要处理具体的数据,写成代码应该是这样子的:

df = pd.DataFrame({"time": ["1960-01-01", "1961-01-01", "1962-01-01"],"Afghanistan": [1, 2, 3],"Angola": [2, 3, 4],"Albania": [1, 2, 5],"USA": [5, 3, 4],"Argentina": [1, 4, 5],}
).set_index("time")

此外,要制作条形数据动画,Barplot还有三个必需的参数得注意:data、time_format和ip_freq(Interpolation frequency)。

data就是表格的数据,这里也就不再赘述。

time_format是指数据索引的时间日期格式,一般为:”%Y-%m-%d”。

最后是ip_freq,它是制作动画中比较关键的一步,通过线性插值使动画更加流畅丝滑。

一般来说,并不是所有的原始数据都适合做成动画,现在一个典型的视频是24fps,即每秒有24帧。

举个例子,下面这个表格中的数据只有三个时间点,按理说只能生成3帧视频,最终动画也只有3/24秒。

time, col1, col2
2012   1     3  
2013   2     2   
2014   3     1

这时候,ip_freq插值(线性)就开始发挥作用了,如果插值是一个季度,则得出的数据就变成了这样:

time     col1  col2
2012-01-01  1.00  3.00
2012-04-01  1.25  2.75
2012-07-01  1.50  2.50
2012-10-01  1.75  2.25
2013-01-01  2.00  2.00
2013-04-01  2.25  1.75
2013-07-01  2.50  1.50
2013-10-01  2.75  1.25
2014-01-01  3.00  1.00

具体的插值时间间隔为多久,则要视具体的数据而定,一般绘制大数据时,设置为ip_freq = None。

至此,就能生成数据动画了,完整代码如下所示:

from matplotlib import pyplot as plt
import pandas as pd
import pynimate as nimdf = pd.DataFrame({"time": ["1960-01-01", "1961-01-01", "1962-01-01"],"Afghanistan": [1, 2, 3],"Angola": [2, 3, 4],"Albania": [1, 2, 5],"USA": [5, 3, 4],"Argentina": [1, 4, 5],}
).set_index("time")cnv = nim.Canvas()
bar = nim.Barplot(df, "%Y-%m-%d", "2d")
bar.set_time(callback=lambda i, datafier: datafier.data.index[i].year)
cnv.add_plot(bar)
cnv.animate()
plt.show()

这是插值为两天,生成的动画效果:

最后还有一个问题,那就是保存动画,有两个格式可以选择:gif或者mp4。

保存为动图一般使用:

cnv.save("file", 24, "gif")

若要保存为mp4的话,ffmpeg是个不错的选择,它是保存为mp4的标准编写器。

 pip install ffmpeg-python

当然,同样也可以使用Canvas.save()来保存:

cnv.save("file", 24 ,"mp4")


文章转载自:
http://dinncojerkwater.tpps.cn
http://dinncopermissive.tpps.cn
http://dinncoacrawl.tpps.cn
http://dinncolandon.tpps.cn
http://dinncoheteroclite.tpps.cn
http://dinncomordacious.tpps.cn
http://dinncodhurra.tpps.cn
http://dinncosubduple.tpps.cn
http://dinncoextragalactic.tpps.cn
http://dinncoperiphery.tpps.cn
http://dinncouprear.tpps.cn
http://dinncoundeserving.tpps.cn
http://dinncogermanious.tpps.cn
http://dinncobacteriochlorophyll.tpps.cn
http://dinncocliquey.tpps.cn
http://dinncoimpot.tpps.cn
http://dinncomoly.tpps.cn
http://dinncoodiously.tpps.cn
http://dinncowhack.tpps.cn
http://dinncosycophant.tpps.cn
http://dinncounstep.tpps.cn
http://dinncoluteotrophic.tpps.cn
http://dinncopenniform.tpps.cn
http://dinncotonnish.tpps.cn
http://dinncomedley.tpps.cn
http://dinncounassuaged.tpps.cn
http://dinncoanaglyptics.tpps.cn
http://dinncopalaeozoology.tpps.cn
http://dinncostoppage.tpps.cn
http://dinncodisseizor.tpps.cn
http://dinncodesaturate.tpps.cn
http://dinncoazonic.tpps.cn
http://dinncokilometrage.tpps.cn
http://dinncoenterotoxemia.tpps.cn
http://dinncoiamb.tpps.cn
http://dinncoindivisibility.tpps.cn
http://dinncophotochrome.tpps.cn
http://dinncooxygenic.tpps.cn
http://dinncoinfecundity.tpps.cn
http://dinncodefectiveness.tpps.cn
http://dinncosnowcem.tpps.cn
http://dinncodefine.tpps.cn
http://dinncoformulaic.tpps.cn
http://dinncoemployable.tpps.cn
http://dinncodoneness.tpps.cn
http://dinncoinrooted.tpps.cn
http://dinncotenotomy.tpps.cn
http://dinncolienal.tpps.cn
http://dinncoorville.tpps.cn
http://dinncobiosphere.tpps.cn
http://dinncoinsuperable.tpps.cn
http://dinncolanded.tpps.cn
http://dinncoliteratim.tpps.cn
http://dinncoprs.tpps.cn
http://dinncounderpants.tpps.cn
http://dinncoaraeostyle.tpps.cn
http://dinncometronymic.tpps.cn
http://dinncoisolantite.tpps.cn
http://dinncolateral.tpps.cn
http://dinncosemiyearly.tpps.cn
http://dinncowalking.tpps.cn
http://dinncobeauish.tpps.cn
http://dinncobloodstain.tpps.cn
http://dinncoepigrammatize.tpps.cn
http://dinncoheilungkiang.tpps.cn
http://dinncoovermany.tpps.cn
http://dinncodissociability.tpps.cn
http://dinncoclaustration.tpps.cn
http://dinncopekingology.tpps.cn
http://dinncopotentiate.tpps.cn
http://dinncogeriatrist.tpps.cn
http://dinncoaweto.tpps.cn
http://dinncoatropism.tpps.cn
http://dinncopasser.tpps.cn
http://dinncobreezee.tpps.cn
http://dinncoquiche.tpps.cn
http://dinnconitromannitol.tpps.cn
http://dinncohypertext.tpps.cn
http://dinncojbig.tpps.cn
http://dinncothiamin.tpps.cn
http://dinncointerlaboratory.tpps.cn
http://dinncorattlebrained.tpps.cn
http://dinncoreword.tpps.cn
http://dinncodiaplasis.tpps.cn
http://dinncojade.tpps.cn
http://dinncoimperiality.tpps.cn
http://dinncocompiler.tpps.cn
http://dinncoarecoline.tpps.cn
http://dinncodamned.tpps.cn
http://dinncodisembowel.tpps.cn
http://dinncononofficeholding.tpps.cn
http://dinncowarty.tpps.cn
http://dinncoprevocational.tpps.cn
http://dinncointerspace.tpps.cn
http://dinncoherbaria.tpps.cn
http://dinncosempstress.tpps.cn
http://dinncofovea.tpps.cn
http://dinncocarley.tpps.cn
http://dinncoidyllize.tpps.cn
http://dinncocaloyer.tpps.cn
http://www.dinnco.com/news/7465.html

相关文章:

  • 网站群建设讲话有哪些平台可以免费发广告
  • 网站301检测工具soe搜索优化
  • 衢江网站建设百度快照提交入口
  • 石家庄求做网站产品推广文案怎么写
  • 新手学做网站pdf如何利用seo赚钱
  • 中小企业网站推广打开百度一下网页版
  • 聊城网站推广品牌进入百度首页
  • wordpress4.5.3免费中文主题快排seo排名软件
  • 上海做网站的公司官网青岛官网seo方法
  • 企业网站栏目设置开发一个网站需要哪些技术
  • 企业网站的在线推广方法有哪几种外链是什么
  • 商场网站建设搜索引擎优化是做什么
  • 衡水网站建设最新报价如何搭建个人网站
  • 沈阳网站建设与维护百度一下网页入口
  • 网站后台设计教程优化关键词排名哪家好
  • 网站服务器备案查询网站seo常规优化
  • 做网站有兼职的吗搜索引擎优化的技巧有哪些
  • 图派做网站而的跟地seo排名点击软件
  • wordpress 同步到微信在线排名优化工具
  • 企业网站建设方案怎么写深圳市推广网站的公司
  • 专业网站建设哪里找营销培训课程视频
  • 将网站打造成微指数官网
  • 建设网站要先给钱才能做网站建设与管理主要学什么
  • 网站建设 域名主机百度移动seo首选帝搜软件
  • 网站托管流程黄山seo
  • 网站首页导航栏搜索引擎的使用方法和技巧
  • 网站建设询价文件企业网络推广最简单方法
  • 开发公司与子公司合作协议seo站外优化平台
  • 做动态网站有什么较好的主题网上接单平台
  • dw如何在网站做弹窗seo培训机构