Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
岳巧源
/
python_script
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
be90278e
authored
Aug 01, 2024
by
岳巧源
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
script
parent
8da26578
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
0 deletions
element_14_data_process.py
waldom_data_process_RMB.py
element_14_data_process.py
0 → 100644
View file @
be90278e
url
=
"http://pfd.premierfarnell.com/eCat_element14_CN_BI.zip"
def
download_zip_file
(
url
=
""
):
start
=
waldom_data_process_RMB.py
View file @
be90278e
...
@@ -58,6 +58,7 @@ def download_file(url=""):
...
@@ -58,6 +58,7 @@ def download_file(url=""):
class
HandleCSV
:
class
HandleCSV
:
def
parse
(
self
,
path
):
def
parse
(
self
,
path
):
df
=
pd
.
read_excel
(
path
,
sheet_name
=
0
)
df
=
pd
.
read_excel
(
path
,
sheet_name
=
0
)
count_msg
=
0
if
not
self
.
validate
(
df
.
columns
.
values
):
if
not
self
.
validate
(
df
.
columns
.
values
):
logger
.
error
(
"文件
%
s 格式错误"
%
path
)
logger
.
error
(
"文件
%
s 格式错误"
%
path
)
return
[]
return
[]
...
@@ -113,8 +114,11 @@ class HandleCSV:
...
@@ -113,8 +114,11 @@ class HandleCSV:
# 统一字符串处理
# 统一字符串处理
table
[
'stock'
]
=
str
(
table
[
'stock'
])
table
[
'stock'
]
=
str
(
table
[
'stock'
])
json_str
=
json
.
dumps
(
table
,
ensure_ascii
=
False
)
json_str
=
json
.
dumps
(
table
,
ensure_ascii
=
False
)
count_msg
+=
1
self
.
push_to_mq
(
json_str
)
self
.
push_to_mq
(
json_str
)
print
(
json_str
)
print
(
json_str
)
logger
.
info
(
"文件
%
s 已解析"
%
file_name
)
logger
.
info
(
"解析行数:
%
s"
%
str
(
count_msg
))
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment