1
我想排序一個熊貓df,但我遇到了負值的問題。熊貓排序()忽略負號
import pandas as pd
df = pd.read_csv('File.txt', sep='\t', header=None)
#Suppress scientific notation (finally)
pd.set_option('display.float_format', lambda x: '%.8f' % x)
print(df)
print(df.dtypes)
print(df.shape)
b = df.sort(axis=0, ascending=True)
print(b)
這給了我升序,但完全無視標誌。
SPATA1 -0.00000005
HMBOX1 0.00000005
SLC38A11 -0.00000005
RP11-571M6.17 0.00000004
GNRH1 -0.00000004
PCDHB8 -0.00000004
CXCL1 0.00000004
RP11-48B3.3 -0.00000004
RNFT2 -0.00000004
GRIK3 -0.00000004
ZNF483 0.00000004
RP11-627G18.1 0.00000003
任何想法我做錯了什麼?
感謝
您可以發佈原始File.txt的樣本以使用嗎? –
這是文件。謝謝你https://drive.google.com/file/d/0Bzv1SNKM1p4uc0FCU2xyZEZnWkk/view?usp=sharing –
你甚至讀過文檔字符串嗎?您正在按列標籤排序。 – Goyo