摘要: 集思录强赎表爬取: 网页样式 实现代码 import requestsimport pandas as pd url = 'https://www.jisilu.cn/data/cbnew/redeem_list/' headers = { 'User-Agent': 'Mozilla/5.0 (W 阅读全文
posted @ 2021-03-04 17:17 汉江S 阅读(1065) 评论(0) 推荐(0) 编辑
摘要: requests模块的编码流程: 指定url 发起请求post/get( url header paramas/data/json proxies) 获取响应数据(爬取到的数据)text json() content 持久化存储 get方法的参数: url params headers get方法的 阅读全文
posted @ 2021-03-03 22:24 汉江S 阅读(146) 评论(0) 推荐(1) 编辑
摘要: import pandas as pd import numpy as np df_day = pd.read_csv('000002_daily.csv',encoding = 'gbk') df_zjc = pd.read_csv('000002_zjc.csv',encoding = 'gbk 阅读全文
posted @ 2021-02-23 10:44 汉江S 阅读(95) 评论(0) 推荐(0) 编辑
摘要: import tushare as ts import pandas as pd import numpy as np import time ts.set_token('xxx') pro = ts.pro_api() # 获取数据 start_date = '20190101' end_date 阅读全文
posted @ 2021-02-19 22:35 汉江S 阅读(116) 评论(0) 推荐(0) 编辑
摘要: import numpy as np df = np.arange(0,210,10) s = map ( str ,df) s2 = [] for i in s: s2.append(i) print(s2) 结果: ['0', '10', '20', '30', '40', '50', '60' 阅读全文
posted @ 2021-02-19 11:31 汉江S 阅读(59) 评论(0) 推荐(0) 编辑
摘要: numpy 数组创建 数组属性 切片索引 1、使用array(列表或元组)还有arange 2、常见索引方式 arr[1:,2:] arr1[2][3] arr1[arr1>3] arr1[~(arr1>3)]取反 arr1[(arr1>3)&(arr1<10)]多条件 3、花式索引 arr1[2, 阅读全文
posted @ 2021-02-18 12:05 汉江S 阅读(60) 评论(0) 推荐(0) 编辑
摘要: """ author:汉江S 微博:汉江S """ from urllib.request import urlopen # python自带爬虫库 import pandas as pd from datetime import datetime import time import re # 正 阅读全文
posted @ 2021-01-21 21:49 汉江S 阅读(1758) 评论(0) 推荐(0) 编辑
摘要: ''' @标题:常用帮助 @作者:汉江S @版本:v1.0 @时间:2021-1-8 ''' import pandas as pd #loc函数使用说明 df = pd.DataFrame([[1, 2], [4, 5], [7, 8]], index=['第一行', '第二行', '第二行'], 阅读全文
posted @ 2021-01-08 20:39 汉江S 阅读(701) 评论(0) 推荐(0) 编辑
摘要: # -*- coding:utf-8 -*- import json import requests import csv import re from lxml import etree import datetime import pandas as pd def get_dat(): head 阅读全文
posted @ 2021-01-06 22:20 汉江S 阅读(856) 评论(0) 推荐(0) 编辑
摘要: ​场景:当我们导出数据后发现数据是多个文件,这个时候我们需要把文件进行合并。 实现思路: 1、通过os文件获取文件的路径; 2、把文件的路径放入一个列表; 3、导入数据; 4、把文件合并后导出。 5、注意:合并时需要把重复的追加数据删除。 步骤: import pandas as pd import 阅读全文
posted @ 2021-01-04 23:13 汉江S 阅读(288) 评论(0) 推荐(0) 编辑