The import pandas as pd
Myarray on=np. Array ([[1, 2, 3], [2 and 4], [three, four, five]])
Rowindex=[' row1 ', 'row2', 'row3]
Colname=[' col1, col2, col3 ']
Mydataframe=pd. DataFrame (data=https://bbs.csdn.net/topics/myarray, index=rowindex, columns=colname)
CodePudding user response:
The import numpy as npThe import pandas as pd
Myarray on=np. Array ([[1, 2, 3], [2 and 4], [three, four, five]])
Rowindex=[' row1 ', 'row2', 'row3]
Colname=[' col1, col2, col3 ']
Mydataframe=pd. DataFrame (data=https://bbs.csdn.net/topics/myarray, index=rowindex, columns=colname)
# print (mydataframe)
D=sorted (mydataframe [' col2], reverse=True)
Print (d)
Results:
[4, 3, 2)
CodePudding user response:
myarray on=np. Array ([[1, 2, 3], [4] 2, [three, four, five]])
Rowindex=[' row1 ', 'row2', 'row3]
Colname=[' col1, col2, col3 ']
Mydataframe=pd. DataFrame (data=https://bbs.csdn.net/topics/myarray, index=rowindex, columns=colname)
Print (mydataframe [' col2] [: : 1])