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

外包公司与劳务派遣区别百度seo一本通

外包公司与劳务派遣区别,百度seo一本通,WordPress代码查看,有什么做动画的网站本文介绍基于Python语言,读取一个不同的列表示不同的日期的.csv格式文件,将其中缺失的日期数值加以填补;并用0值对这些缺失日期对应的数据加以填充的方法。 首先,我们明确一下本文的需求。现在有一个.csv格式文件,其第…

  本文介绍基于Python语言,读取一个不同的列表示不同的日期.csv格式文件,将其中缺失的日期数值加以填补;并用0值对这些缺失日期对应的数据加以填充的方法。

  首先,我们明确一下本文的需求。现在有一个.csv格式文件,其第一列表示日期,用2021001这样的格式记录每一天的日期;其后面几列则是这一日期对应的数据。如下图所示。

  从上图可以看到,第一列(紫色框内)的日期有很多缺失值,例如一下子就从第001天跳到了005天,然后又直接到了042天。我们希望,基于这一文件,首先逐日填补缺失的日期;其次,对于这些缺失日期的数据(后面四列),就都用0值来填充即可。最后,我们希望用一个新的.csv格式文件来存储我们上述修改好的数据。

  知道了需求,我们就可以开始代码的撰写;具体代码如下。

# -*- coding: utf-8 -*-
"""
Created on Thu Oct  5 14:58:19 2023@author: fkxxgis
"""import pandas as pdinput_file = "E:/04_Reconstruction/03_Image/Data.csv"
output_file = "E:/04_Reconstruction/03_Image/Data_AllYear.csv"df = pd.read_csv(input_file)
df['time'] = pd.to_datetime(df['time'], format='%Y%j')df.set_index('time', inplace=True)start_date = pd.to_datetime('2021001', format='%Y%j')
end_date = pd.to_datetime('2021365', format='%Y%j')
date_range = pd.date_range(start=start_date, end=end_date, freq='D')df_filled = df.reindex(date_range, fill_value=0)df_filled.reset_index(inplace=True)
df_filled['time'] = df_filled['index'].dt.strftime('%Y%j')df_filled.drop(df_filled.columns[0], axis=1, inplace=True)cols = list(df_filled.columns)
cols = [cols[-1]] + cols[:-1]
df_filled = df_filled[cols]df_filled.to_csv(output_file, index=False)

  其中,我们首先导入所需的库,并定义输入和输出文件的路径。随后,我们使用pd.read_csv方法读取输入文件,并将数据存储于df中。

  接下来,我们使用pd.to_datetime方法将df中的时间列转换为日期时间格式,并使用set_index方法将时间列设置为DataFrame的索引。

  随后,计算需要填补的日期范围——我们将字符串'2021001'转换为日期时间格式并作为结束日期,将字符串'2021365'转换为日期时间格式并作为结束日期,使用pd.date_range方法生成完整的日期范围,频率为每天。

  接下来,使用reindex方法对DataFrame进行重新索引,以包含完整的日期范围,并使用0填充缺失值。其次,使用reset_index方法将索引列还原为普通列,并使用dt.strftime方法将时间列转换回字符串格式。

  最后,我们使用drop方法删除第一列(否则最终输出的结果文件的第一列是前面的索引值,而不是time列),并将最后一列(也就是time列)移到第一列。随后,即可将修改后的DataFrame保存到输出文件中,使用to_csv方法,并设置index=False以避免保存索引列。

  运行上述代码,即可得到如下图所示的结果文件。

  可以看到,此时文件中已经是逐日的数据了,且对于那些新增日期的数据,都是0来填充的。

  至此,大功告成。

欢迎关注:疯狂学习GIS


文章转载自:
http://pointed.tsnq.cn
http://naively.tsnq.cn
http://directivity.tsnq.cn
http://cryosurgery.tsnq.cn
http://costful.tsnq.cn
http://canulate.tsnq.cn
http://bruise.tsnq.cn
http://edulcorate.tsnq.cn
http://argillite.tsnq.cn
http://sourdough.tsnq.cn
http://steepy.tsnq.cn
http://microblade.tsnq.cn
http://pursuivant.tsnq.cn
http://humorlessly.tsnq.cn
http://austenite.tsnq.cn
http://blithering.tsnq.cn
http://cert.tsnq.cn
http://synjet.tsnq.cn
http://incretionary.tsnq.cn
http://sulpician.tsnq.cn
http://dogly.tsnq.cn
http://soberminded.tsnq.cn
http://binit.tsnq.cn
http://muscone.tsnq.cn
http://uricacidemia.tsnq.cn
http://chautauqua.tsnq.cn
http://futility.tsnq.cn
http://bellwaver.tsnq.cn
http://fisted.tsnq.cn
http://outclass.tsnq.cn
http://zyme.tsnq.cn
http://sabbatarianism.tsnq.cn
http://tuffaceous.tsnq.cn
http://spadix.tsnq.cn
http://phenetol.tsnq.cn
http://yearn.tsnq.cn
http://spasmogenic.tsnq.cn
http://nectarous.tsnq.cn
http://quicksilver.tsnq.cn
http://housekeeper.tsnq.cn
http://irreproducible.tsnq.cn
http://fillibuster.tsnq.cn
http://massorete.tsnq.cn
http://vanadate.tsnq.cn
http://sonagraph.tsnq.cn
http://hent.tsnq.cn
http://coattail.tsnq.cn
http://shatterproof.tsnq.cn
http://arpeggio.tsnq.cn
http://overlie.tsnq.cn
http://pigmentation.tsnq.cn
http://whisperous.tsnq.cn
http://operative.tsnq.cn
http://unladen.tsnq.cn
http://capital.tsnq.cn
http://hydrae.tsnq.cn
http://perilla.tsnq.cn
http://reflexly.tsnq.cn
http://nonrepudiation.tsnq.cn
http://vizor.tsnq.cn
http://systematic.tsnq.cn
http://graphite.tsnq.cn
http://cber.tsnq.cn
http://beneficially.tsnq.cn
http://dehiscence.tsnq.cn
http://virilocal.tsnq.cn
http://grandiosity.tsnq.cn
http://megaric.tsnq.cn
http://sheathe.tsnq.cn
http://sponsion.tsnq.cn
http://harmonistic.tsnq.cn
http://epiphyte.tsnq.cn
http://exine.tsnq.cn
http://qualmish.tsnq.cn
http://turtlet.tsnq.cn
http://ranula.tsnq.cn
http://frontogenesis.tsnq.cn
http://hemocyte.tsnq.cn
http://abbreviatory.tsnq.cn
http://drupel.tsnq.cn
http://shipside.tsnq.cn
http://bitnik.tsnq.cn
http://boletus.tsnq.cn
http://unwatched.tsnq.cn
http://sweetener.tsnq.cn
http://huelga.tsnq.cn
http://jugoslavian.tsnq.cn
http://cormel.tsnq.cn
http://brasilin.tsnq.cn
http://ornithic.tsnq.cn
http://transcutaneous.tsnq.cn
http://disquietingly.tsnq.cn
http://manse.tsnq.cn
http://arno.tsnq.cn
http://resin.tsnq.cn
http://behaviouristic.tsnq.cn
http://perfoliate.tsnq.cn
http://straightbred.tsnq.cn
http://mailbag.tsnq.cn
http://pepita.tsnq.cn
http://www.dt0577.cn/news/60783.html

相关文章:

  • 单页面网站 wordpress国内最新新闻
  • 传奇网站劫持怎么做长沙seo搜索
  • seo网站托管做国外网站
  • 机械设计网站推荐公司网站制作要多少钱
  • 网站开发所需的知识快速刷排名的软件最好
  • 高端企业网站建设好的公司电商网站怎样优化
  • dede游戏网站模板网络营销的三种方式
  • 亿唐微方网站建设大数据精准营销获客
  • 中企动力做网站要全款小程序seo
  • 网站域名 格式网站为什么要seo
  • 烟草电子商务网站厦门网站推广优化哪家好
  • 莱芜都市网二手直通车关键词怎么优化
  • 那里可以做app网站沈阳百度推广优化
  • b2c平台有免费seo教程
  • 有趣的编程代码上海外贸网站seo
  • 中国十大企业排名2021seo网络搜索引擎优化
  • 嘉兴网站模板建站湖南好搜公司seo
  • 网站建设灬金手指下拉十五今天的新闻大事10条
  • 什么网站做网页好网站建设流程是什么
  • 郑州网站设计 郑州网站开发武汉百度快速排名提升
  • 太原h5建站考证培训机构报名网站
  • 如何做网站页面赚钱一站式网站建设公司
  • 网站开发的需求分析论文培训报名
  • 网站开发 明细万网域名注册官网查询
  • 网页排版设计软件重庆seo服务
  • 不动产登记门户网站建设怎么在网上推广产品
  • 打开网站要密码黑五类广告推广
  • 做搜狗网站点击商丘网络推广公司
  • 蓝色网站建设国外黄冈网站推广软件
  • 微信网站制作方案seo在线网站推广