Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
P
papertools
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
hanhusheng
papertools
Commits
18b2b568
Commit
18b2b568
authored
May 08, 2025
by
Tian_zi_kang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
tianzikang update: 6-zhimingqiye adapts to xlsx input
parent
1e5d8dd4
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
20 additions
and
3 deletions
+20
-3
add-niuren-location-zhimingqiye/6-zhimingqiye.py
+4
-1
add-niuren-location-zhimingqiye/__pycache__/utils.cpython-38.pyc
+0
-0
add-niuren-location-zhimingqiye/utils.py
+16
-2
No files found.
add-niuren-location-zhimingqiye/6-zhimingqiye.py
View file @
18b2b568
...
...
@@ -6,7 +6,10 @@ df = pd.read_excel("知名企业.xlsx")
qiye_name
=
df
[
"企业-英文名"
]
.
tolist
()
file_name
=
"good_papers-niuren-task_10.csv"
final
=
pd
.
read_csv
(
file_name
,
encoding
=
'utf-8-sig'
)
if
file_name
.
endswith
(
".xlsx"
):
final
=
pd
.
read_excel
(
file_name
,
engine
=
'openpyxl'
)
elif
file_name
.
endswith
(
".csv"
):
final
=
pd
.
read_csv
(
file_name
,
encoding
=
'utf-8-sig'
)
# add continent_country column
final
[
"知名企业"
]
=
""
...
...
add-niuren-location-zhimingqiye/__pycache__/utils.cpython-38.pyc
0 → 100644
View file @
18b2b568
File added
add-niuren-location-zhimingqiye/utils.py
View file @
18b2b568
...
...
@@ -223,4 +223,19 @@ def parse_name(name):
candidate_names
.
append
(
f
"{last_name}, {first_name_part}"
)
return
candidate_names
\ No newline at end of file
return
candidate_names
import
pandas
as
pd
def
csv_to_xlsx
(
csv_file_path
,
xlsx_file_path
):
try
:
# 读取 CSV 文件
df
=
pd
.
read_csv
(
csv_file_path
)
print
(
f
"成功读取 CSV 文件:{csv_file_path}"
)
# 将数据写入 XLSX 文件
df
.
to_excel
(
xlsx_file_path
,
index
=
False
,
engine
=
'openpyxl'
)
print
(
f
"成功将数据写入 XLSX 文件:{xlsx_file_path}"
)
except
Exception
as
e
:
print
(
f
"转换过程中发生错误:{e}"
)
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