Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
DTOM
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
XXXX
DTOM
Commits
ef51236c
Commit
ef51236c
authored
3 years ago
by
PENG MacAir
Browse files
Options
Downloads
Patches
Plain Diff
DTOM 1 version
parents
Loading
Loading
1 merge request
!1
Master
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
Reading.py
+49
-0
49 additions, 0 deletions
Reading.py
with
49 additions
and
0 deletions
Reading.py
0 → 100755
+
49
−
0
View file @
ef51236c
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Fri Jun 19 17:24:31 2020
@author: taopeng
"""
import
xlrd
def
excel_data
(
file
):
# 打开Excel文件读取数据
data
=
xlrd
.
open_workbook
(
file
)
# 获取第一个工作表
table
=
data
.
sheet_by_index
(
3
)
# 获取行数
nrows
=
table
.
nrows
# 获取列数
ncols
=
table
.
ncols
# 定义excel_list
excel_list
=
[]
for
row
in
range
(
1
,
nrows
):
myRow
=
[]
for
col
in
range
(
ncols
):
# 获取单元格数据
cell_value
=
table
.
cell
(
row
,
col
).
value
# 把数据追加到excel_list中
myRow
.
append
(
cell_value
)
excel_list
.
append
(
myRow
)
return
excel_list
mylist
=
excel_data
(
'
ourExcel.xlsx
'
)
for
i
in
range
(
0
,
len
(
mylist
)):
if
i
<
5
:
print
(
mylist
[
i
])
# we select client whose 18 < age < 50, that means bd 1950-2002
import
time
for
i
in
range
(
0
,
len
(
mylist
)):
if
i
<
5
and
i
>
1
:
# myTime = timeArray = time.strptime(int(mylist[i][5]), "%Y-%m-%d %H:%M:%S")
print
(
mylist
[
i
])
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment