- 博客(18)
- 资源 (1)
- 收藏
- 关注
原创 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
3736
1
原创 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
455
转载 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
17716
原创 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
2299
原创 python--mqtt后台消息的接收与转发
# coding=utf-8#接收数据代码模块import paho.mqtt.client as mqttimport jsondef on_message(client, userdata, msg,user_id = 11029): data = str(msg.payload) jsonDict = json.loads(data) if(jsonDict is not ...
2018-03-07 16:04:47
8446
原创 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
1355
转载 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
1106
转载 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
625
转载 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
819
转载 python--selenium与自动化购物流程
#coding=utf-8'''登录smzdm.com,并签到'''from selenium import webdriverfrom seleniuim.webdriver.support.ui import WebDriverWait as Waitfrom selenium.common.exceptions import NoSuchAttributeException,\ NoS...
2018-03-07 15:36:24
1500
转载 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
536
转载 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
595
原创 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
3788
原创 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
702
转载 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
5822
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人