pandas读出EXCEL表格后为什么不能排序?
我在一段代码完成后,形成了EXCEL文件,又想对EXCEL文件内容进行排序,但按如下代码始终无法完成。请教各位大佬,问题在哪里f = pd.ExcelFile(r'C:\Users\Administrator\Desktop\%s%s.xls' % (time1, 'my_file'))
f.sheet_names
data = pd.DataFrame()
d = pd.read_excel(r'C:\Users\Administrator\Desktop\%s%s.xls' % (time1, 'my_file'), sheet_name='json_file')
data = pd.concat()
print(data)
data.shape
data.sort_values(by='PQ', ascending=False)
workbook.save(r'C:\Users\Administrator\Desktop\%s%s.xls' % (time1, 'my_file')) 你的表格文件发出来
C:\Users\Administrator\Desktop\my_file.xls 文件名:my_file.xls,,工作表名:json_file
序号 IDS AS BV MS PQ
1 6289077 0.017957077 0.729179379 10840 5.213460831
2 544637571 0.004861721 0.093554054 1005 0.081868586
3 540608091 0.006129681 0.478785557 816 0.346572088
4 756239511 0.004672897 0.825025961 391 3.48380091
5 57591384 0.011428571 0.283257677 1489 3.668273873
6 972483038 0.003447548 0.361636736 237532 4.116014786
7 712232063 0.0365201 0.155263638 4291 1.656191001
8 844538694 0.00486069 0.093534222 1005 0.081868586
9 21334868 0.011000278 0.292457868 3750 2.008920949
10 459963400 0.027985202 0.493286292 12200 3.102915944
11 929161543 0.002902891 0.319042967 297683 5.305339339
12 544760267 0.066491741 0.205617508 1665 4.527208645
13 844933758 0.007223804 0.563614782 35630 3.172400461
14 3465267 0.005268935 0.119648738 123 1.027994721
15 34030374 0.017084627 0.057634157 2960 3.205452805
16 204171275 0.020445364 0.835603178 47934 4.191408689
17 929608064 0.005336489 0.290273971 19194 4.935099324
18 43421290 0.003392878 0.298283262 2564 1.505443384
liuzg123 发表于 2021-4-7 09:58
C:%users\Administrator\Desktop\my_file.xls
你是来搞笑的吗 我能访问你的硬盘???? 不会上传文件,见笑了
页:
[1]