Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
岳巧源
/
data_server
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
597c0e52
authored
Aug 27, 2024
by
岳巧源
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
add is_number
parent
49d6b824
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
0 deletions
handle.py
handle.py
View file @
597c0e52
...
...
@@ -53,6 +53,20 @@ class Producer:
except
Exception
as
e
:
print
(
e
)
"""判断传入的字符串是不是数字"""
def
is_number
(
s
:
str
):
try
:
float
(
s
)
return
True
except
ValueError
:
pass
try
:
import
unicodedata
unicodedata
.
numeric
(
s
)
return
True
except
(
TypeError
,
ValueError
):
pass
return
False
def
resolve
(
file_name
:
str
,
supplier_id
:
int
):
producer
=
Producer
()
...
...
@@ -105,6 +119,8 @@ def resolve(file_name: str, supplier_id: int):
for
index
in
range
(
1
,
6
):
ladder_data
=
df
.
loc
[
i
,
"阶梯数量"
+
str
(
index
)]
price_data
=
df
.
loc
[
i
,
"价格"
+
str
(
index
)]
if
not
is_number
(
str
(
price_data
))
or
not
is_number
(
str
(
ladder_data
)):
continue
if
str
(
ladder_data
)
.
strip
()
!=
""
and
str
(
ladder_data
)
.
strip
()
!=
"nan"
and
str
(
ladder_data
)
.
strip
()
!=
"NaN"
and
\
str
(
price_data
)
.
strip
()
!=
""
and
str
(
price_data
)
.
strip
()
!=
"nan"
and
str
(
price_data
)
.
strip
()
!=
"NaN"
:
item_map
=
dict
()
...
...
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