数据处理
文章平均质量分 57
echodouble
pick me up
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
python读取txt数据,转换到excel表中
接收后台模拟数据,存放在txt文件中,需要转换到excel中txt中的数据格式为: recv message - 82815: {"export1": 0, "export0": 0, "export3": 1, "export2": 0, "export5": 0, "export4": 0, "clean1_5": 0, "clean1_4": 2, "clean1_1": 0转载 2016-12-30 10:31:53 · 5990 阅读 · 0 评论 -
python与excel:数组写入到excel
import openpyxlfrom openpyxl.workbook import Workbookimport datetimeoutwb = Workbook()wo = outwb.activecareerSheet = outwb.create_sheet('career',0)# careerSheet['A1']= datetime.datetime.now()...转载 2018-05-23 10:55:34 · 17939 阅读 · 0 评论 -
python--配置数据读取csv文件数据
def sleep_csv_post(filepath): df = pd.read_csv(filepath) for i, row in df.iterrows(): current_status_time = get_time(row["current_status_time"]) message = { "status": ro...原创 2018-07-03 14:01:36 · 533 阅读 · 0 评论 -
python--从hbase查询数据
import pandas as pddevice_id = ***start_time = time_utils.string_to_timestamp("2018-06-29_04-00-00") * 1000end_time = time_utils.string_to_timestamp("2018-06-29_07-00-00") * 1000hbase = hbase_util...原创 2018-07-06 11:30:58 · 3842 阅读 · 1 评论 -
python--数据写入csv
# -*- coding: utf-8 -*-import sysimport globa_dataimport csvreload(sys)sys.setdefaultencoding('utf8')# 读取要解析的文件def data_process(path1): all_data = [] with open(path1, 'r') as f: lines = f...原创 2018-03-07 16:11:49 · 2391 阅读 · 0 评论 -
python --数据库查询数据
#coding=utf-8import MySQLdbimport time# 打开数据库连接(ip/数据库用户名/登录密码/数据库名)class QueryDatabase(): def RecordSuccess(self,sql): try: cursor.execute(sql) resultT =cur...原创 2018-03-07 15:07:02 · 808 阅读 · 0 评论 -
python--Hbase插入数据
#coding=utf-8import happybaseport = xxxxxxhost = xxxxxxclass HbaseConPool(object): '''hbase连接池''' def __init__(self): ''' Constructor ''' self.pool = happybase.Connec...原创 2018-03-07 15:17:19 · 3911 阅读 · 0 评论 -
python--爬虫电影数据
# coding=utf-8'''获取豆瓣电影以及读书中的数据'''from selenium import webdriverimport timeimport sysfrom docutils.parsers.rst.directives import pathclass Douban: def __init__(self): self.movie_...转载 2018-03-07 15:27:55 · 808 阅读 · 0 评论 -
python--爬虫天气数据
#coding=utf-8'''抓取北上广深的pm2.5值,按照空气质量从优到劣排序'''from selenium import webdriverclass PM25(): def __init__(self): base_url = "http://www.pm25.com/%s.html" self.urls = [] for city in...转载 2018-03-07 15:32:30 · 692 阅读 · 0 评论 -
python--爬虫百度天气数据
#coding=utf-8'''从百度或者http://www.weather.com.cn获取天气情况'''from selenium import webdriverimport timeclass BaiduWeather(): def __init__(self): self.query_url = 'http://www.baidu.com/s?wd=%stianqi...转载 2018-03-07 15:39:37 · 930 阅读 · 0 评论 -
python--爬虫微博热门数据
#coding=utf-8'''从weibo.com中获取前20条热门话题'''from selenium import webdriverfrom selenium.webdriver.support.ui import WebDriverWait as Waitimport unittestimport time import sysreload(sys)sys.setdefaultenco...转载 2018-03-07 15:41:54 · 681 阅读 · 0 评论 -
python--爬虫知乎热门数据
#coding=utf-8'''从zhihu.com中获取每日最热和每月最热'''from selenium import webdriverfrom datatime import dateimport timeimport sysreload(sys)sys.setdefaultencoding("utf8")class Zhihu(): def __init__(self): ...转载 2018-03-07 15:44:54 · 1175 阅读 · 0 评论 -
python--正则表达式过滤数据
import reimport csvimport jsonCONFIG_HEADER = ["ChangeSrc", "timestamp", "power", "bright", "ct", "device_id"]RUN_HEADER = ["ChangeSrc", "timestamp", "ManualAD", &quo原创 2018-03-07 15:50:53 · 1411 阅读 · 0 评论
分享