cell

python3与Excel的完美结合

痞子三分冷 提交于 2020-02-09 19:21:39
import openpyxl # 1. 读取excel文档 wb = openpyxl.load_workbook(r'F:\1.xlsx') # # 返回一个workbook对象, 有点类似于文件对象; # print(wb, type(wb)) # 2. 在工作薄中取得工作表 # print(wb.get_sheet_names()) # 返回一个列表, 存储excel表中所有的sheet工作表; print(wb.sheetnames) # 返回一个worksheet对象, 返回当前的活动表; # print(wb.get_active_sheet()) # print(wb.active) # 3. 获取工作表中, 单元格的信息 # wb.get_sheet_by_name('Sheet1') sheet = wb[wb.sheetnames[0]] print(sheet['A1']) print(sheet['B1'].value) cell = sheet['B1'] print(cell.row, cell.column) print(sheet.cell(row=3, column=2)) print(sheet.cell(row=3, column=2).value) print(sheet.cell(row=3, column=2, value='www')

python-openpyxl操作excel

不羁的心 提交于 2020-02-09 07:51:34
python 读写 excel有很多选择,但是,方便操作的库不多,在我尝试了几个库之后,我觉得两个比较方便的库是xlrd/xlwt、openpyxl。 之所以推荐这两个库是因为这两个库分别操作的是不同版本的excel,xlrd操作的是xls/xlxs格式的excel,openpyxl只支持xlxs格式的excel,openpyxl使用起来更方便一些。 安装 pip install openpyxl 如果excel里面有图片(jpeg,png,bmp,......)需要安装图片处理模块 pip install pillow excel写 from openpyxl import Workbook wb = Workbook() 创建一个新的工作簿 ws1 = wb.create_sheet("Mysheet") #默认最后一个 ws2 = wb.create_sheet("Mysheet", 0) #第一个 拷贝模板做新表 ws3 = wb.copy_worksheet(wb['Sheet1']) 保存 wb.save('balances.xlsx') 修改工作簿的名称 ws.title = "New Title" 获取所有工作簿名称 print(wb.sheetnames) 获取其中一个工作簿名称 for sheet in wb: print(sheet) wb["New

图像处理

与世无争的帅哥 提交于 2020-02-09 01:41:57
# -*- coding: utf-8 -*- """ Created on Mon Sep 24 18:23:04 2018 @author: zy """ # 代码来源GitHub:https://github.com/PENGZhaoqing/Hog-feature # https://blog.csdn.net/ppp8300885/article/details/71078555 # https://www.leiphone.com/news/201708/ZKsGd2JRKr766wEd.html import cv2 import numpy as np import math import matplotlib.pyplot as plt class Hog_descriptor(): ''' HOG描述符的实现 ''' def __init__(self, img, cell_size=8, bin_size=36): ''' 构造函数 默认参数,一个block由2x2个cell组成,步长为1个cell大小 args: img:输入图像(更准确的说是检测窗口),这里要求为灰度图像 对于行人检测图像大小一般为128x64 即是输入图像上的一小块裁切区域 cell_size:细胞单元的大小 如8,表示8x8个像素 bin_size:直方图的bin个数 ''' self

java poi学习 Excel的读取与写

与世无争的帅哥 提交于 2020-02-08 19:24:34
一、Excel的写操作    在Excel为我们提供了两种文件类型.XLS和.XLSX文件,这两种文件的读取方式都是一致的.xls文件使用的是HSSF对象,.xlsx使用的是XSSF对象,因为两种方式是一样的,所以我们来看一个HSSF读取的例子   1.导入maven <dependency> <groupId>org.apache.poi</groupId> <artifactId>poi</artifactId> <version>3.9</version> </dependency> <dependency> <groupId>org.apache.poi</groupId> <artifactId>poi-ooxml</artifactId> <version>3.9</version> </dependency> <!--时间工具类--> <dependency> <groupId>joda-time</groupId> <artifactId>joda-time</artifactId> <version>2.10.1</version> </dependency>    2.Excel的写操作   我们先看看我们最终要生成的表格: import org.apache.poi.hssf.usermodel.HSSFCellStyle; import org.apache

2018 ICPC Asia Jiaozuo Onsite F. Honeycomb #BFS#

限于喜欢 提交于 2020-02-08 19:15:54
F. Honeycomb time limit per test 4 seconds memory limit per test 1024 megabytes input standard input output standard output A honeycomb is a mass wax cells built by honey bees, which can be described as a regular tiling of the Euclidean plane, in which three hexagons meet at each internal vertex. The internal angle of a hexagon is 120120 degrees, so three hexagons at a point make a full 360360 degrees. The following figure shows a complete honeycomb with 33 rows and 44 columns. Here we guarantee that the first cell in the second column always locates in the bottom right side of the first cell

UITableView的基本使用

自闭症网瘾萝莉.ら 提交于 2020-02-08 19:07:11
UITableView基本使用 展示多组数据 # import "ViewController.h" @interface ViewController ( ) < UITableViewDataSource > @property ( nonatomic , weak ) IBOutlet UITableView * tableView ; @end @implementation ViewController - ( void ) viewDidLoad { [ super viewDidLoad ] ; self . tableView . dataSource = self ; } //告诉TableView一共有多少组 - ( NSInteger ) numberOfSectionsInTableView : ( UITableView * ) tableView { return 4 ; //展示4组数据 } //告诉TableView第section组有多少行 - ( NSInteger ) tableView : ( UITableView * ) tableView numberOfRowsInSection : ( NSInteger ) section { if ( section == 0 ) { //第0组有多少行 return 2 ; } else if

WAS常见问题处理

假装没事ソ 提交于 2020-02-08 06:22:48
WAS 缓存导致修改文件不生效问题: 解决方法: 一、修改 web.xml 文件,需要修改以下三个目录下的文件: /opt/IBM/WebSphere/AppServer/profiles/Dmgr01/config/cells/ c e l l 名 / a p p l i c a t i o n s / {cell 名}/applications/ c e l l 名 / a p p l i c a t i o n s / {应用名}.ear/deployments/ 应 用 名 / {应用名}/ 应 用 名 / {应用名}.war/WEB-INF /opt/IBM/WebSphere/AppServer/profiles/AppSrv01/config/cells/ c e l l 名 / a p p l i c a t i o n s / {cell 名}/applications/ c e l l 名 / a p p l i c a t i o n s / {应用名}.ear/deployments/ 应 用 名 / {应用名}/ 应 用 名 / {应用名}.war/WEB-INF /opt/IBM/WebSphere/AppServer/profiles/AppSrv01/installedApps/ c e l l 名 / {cell 名}/ c e l l 名 /

Python数据分析基础之Excel文件(3)

僤鯓⒐⒋嵵緔 提交于 2020-02-07 19:37:18
选取特定列   有些时候,我们并不需要工作表中所有的列。我们可以用Python选取出需要保留的列。   有两种方法可以在Excel文件中选取特定的列:   1.使用列索引值;   2.使用列标题。 1.1 使用列索引值(基础Python)   这里我们以保留之前的 january_2013 工作表中Customer Name和Purchase Date这两列为例。代码如下: #!/usr/bin/env python3 import sys from datetime import date from xlrd import open_workbook, xldate_as_tuple from xlwt import Workbook input_file = sys.argv[1] output_file = sys.argv[2] output_workbook = Workbook() output_worksheet = output_workbook.add_sheet('jan_2013_output') my_columns = [1, 4] with open_workbook(input_file) as workbook: worksheet = workbook.sheet_by_name('january_2013') data = [] for row

python读取excel文件

不打扰是莪最后的温柔 提交于 2020-02-07 06:50:54
示例excel文件内容: 读取上述excel文件: # coding:utf-8 import xlrd from xlrd import xldate_as_tuple import xlwt import os from datetime import datetime current_path = os.path.dirname(os.path.abspath(__file__)) excel_path = os.path.join(current_path, "data", "test_excel.xlsx") class UserInfo(object): """ 对应于excel中的用户信息sheet页 """ def __init__(self, *args): if len(args) >= 4: self._username = args[0] self._gender = args[1] self._age = args[2] self._occupation = args[3] def print_userinfo(self): print(self._username, self._gender, self._age, self._occupation) class MovieInfo(object): """ 对应于excel中的电影信息sheet页 ""

【时空序列预测第四篇】PredRNN++: Towards A Resolution of the Deep-in-Time Dilemma in Spatiotemporal Predictive

风格不统一 提交于 2020-02-06 20:15:33
前言 保持住节奏,每周起码一篇paper reading,要时刻了解研究的前沿,是一个不管是工程岗位还是研究岗位AIer必备的工作,共勉! 准备再写几篇这种非常细致的文章之后,接下来写作主要集中在模型的结构,创新点,解决的问题,以及比较巧妙的操作,代码实战,以及我个人感觉需要写下来,并且有意思的东西。 一、Address 这是ICML2018年的一篇paper,来自于清华的团队 PredRNN++: Towards A Resolution of the Deep-in-Time Dilemma in Spatiotemporal Predictive http://proceedings.mlr.press/v80/wang18b/wang18b.pdf 二、Introduction 2.1 创新思路 文中abstract中先指出本文作者的创新之一在于把双memory用级联的方式链接构建新的LSTM结构(Causal LSTM),并且全篇文章围绕deeper in time来说明,这里deeper in time在读完全篇之后理解为就是网络cell的堆叠和时间步的结构。 这里还提出了用一个gradient highway units work去解决存在的梯度消失问题,并且此结构和Causal LSTM无缝连接。 句子后面之所以会强调自适应的获取短时和长时的信息依赖