大橙子网站建设,新征程启航
为企业提供网站建设、域名注册、服务器等服务
这篇文章主要介绍Pandas中Cookbook时间戳处理的示例分析,文中介绍的非常详细,具有一定的参考价值,感兴趣的小伙伴们一定要看完!
创新互联沟通电话:13518219792,为您提供成都网站建设网页设计及定制高端网站建设服务,创新互联网页制作领域10余年,包括成都混凝土搅拌罐车等多个行业拥有多年的网站设计经验,选择创新互联,为企业保驾护航!上代码
# -*-coding:utf-8-*- # by kevinelstri # 2017.2.17 # --------------------- # Chapter 8 - How to deal with timestamps.ipynb # --------------------- import pandas as pd ''' 8.1 Parsing Unix timestamps ''' popcon = pd.read_csv('../data/popularity-contest', sep=' ') # print popcon.head() popcon.columns = ['atime', 'ctime', 'package-name', 'mru-program', 'tag'] # print popcon[:5] print popcon['atime'].dtype popcon['atime'] = popcon['atime'].astype(int) # print popcon['atime'][:5] # popcon['ctime'] = popcon['ctime'].astype(int) popcon['atime'] = pd.to_datetime(popcon['atime']) # popcon['ctime'] = pd.to_datetime(popcon['ctime'], unit='s') # print popcon['atime'][:5] popcon = popcon[popcon['atime'] > '1970-01-01'] nonlibraries = popcon[~popcon['package-name'].str.contains('lib')] nonlibraries.sort('ctime', ascending=False)[:10]
以上是“Pandas中Cookbook时间戳处理的示例分析”这篇文章的所有内容,感谢各位的阅读!希望分享的内容对大家有帮助,更多相关知识,欢迎关注创新互联行业资讯频道!