摘要: from pandas import DataFrame from pandas_datareader import data as web all_data = {} for ticker in ['AAPL','IBM','MSFT','GOOG']: all_data[ticker] = we 阅读全文
posted @ 2021-02-13 13:06 OTAKU_nicole 阅读(344) 评论(0) 推荐(0) 编辑
摘要: import pandas.io.data as web报错ModuleNotFoundError: No module named 'pandas.io.data'安装pandas_datareader后改为 from pandas_datareader import data as web 阅读全文
posted @ 2021-02-13 12:28 OTAKU_nicole 阅读(1118) 评论(0) 推荐(0) 编辑
摘要: import openpyxl list_wb = openpyxl.load_workbook('list.xlsx') #打开现有工作表 sheet = list_wb.active print(sheet.max_row) # 获取最大行 print(sheet.max_column) # 获 阅读全文
posted @ 2021-02-08 18:00 OTAKU_nicole 阅读(132) 评论(0) 推荐(0) 编辑
摘要: import xlrd from xlutils.copy import copy # 打开Excel wb = xlrd.open_workbook('list.xls') # 打开Excel的sheet,有多种方式,此处选择第一个sheet sheet = wb.sheet_by_index(0 阅读全文
posted @ 2021-02-08 14:26 OTAKU_nicole 阅读(81) 评论(0) 推荐(0) 编辑
摘要: from PIL import Image left = 763 top = 863 right = 1258 bottom = 962 im = Image.open("img.jpg") im = im.crop((left, top, right, bottom)) im.save("img_ 阅读全文
posted @ 2021-01-25 11:31 OTAKU_nicole 阅读(167) 评论(0) 推荐(0) 编辑
摘要: Python3.5中:iteritems变为items 阅读全文
posted @ 2020-10-15 11:54 OTAKU_nicole 阅读(629) 评论(0) 推荐(0) 编辑
摘要: import requests pic_url = "https://www.baidu.com/img/PCtm_d9c8750bed0b3c7d089fa7d55720d6cf.png" r = requests.get(pic_url) with open("1.png", "wb")as f 阅读全文
posted @ 2020-10-15 10:58 OTAKU_nicole 阅读(1458) 评论(0) 推荐(0) 编辑
摘要: from pandas import DataFrame, Series import numpy as np df = DataFrame([[1.4,np.nan],[7.1,-4.5], [np.nan,np.nan],[0.75,-1.3]], index=['a','b','c','d'] 阅读全文
posted @ 2020-10-14 17:10 OTAKU_nicole 阅读(96) 评论(0) 推荐(0) 编辑
摘要: 重新索引 from pandas import Series,DataFrame # Series重新索引 obj = Series([4.5,7.2,-5.3,3.6],index=['d','b','a','c']) print(obj) ''' d 4.5 b 7.2 a -5.3 c 3.6 阅读全文
posted @ 2020-10-14 16:26 OTAKU_nicole 阅读(67) 评论(0) 推荐(0) 编辑
摘要: import optparse def testparam(paramA,paramB,paramC='C'): print('paramA:', paramA) print('paramB:', paramB) print('paramC:', paramC) def main(): parser 阅读全文
posted @ 2020-10-07 20:16 OTAKU_nicole 阅读(106) 评论(0) 推荐(0) 编辑