2
我有以下的熊貓系列:如何系列指數轉換成兩列的數據幀
import pandas as pd
import io
from scipy import stats
test=u"""probegenes,sample1
1415777_at Pnliprp1,20
1415884_at Cela3b,47
1415805_at Clps,17
1115805_at Ckkk,77
"""
df_test = pd.read_csv(io.StringIO(test),index_col='probegenes')
my_series = df_test['sample1']
my_series
它看起來像這樣:
In [62]: my_series
Out[62]:
probegenes
1415777_at Pnliprp1 20
1415884_at Cela3b 47
1415805_at Clps 17
1115805_at Ckkk 77
Name: sample1, dtype: int64
我想要做的是分裂「探針基因的索引,以便我得到新的數據框:
Probe Genes Score
0 1415777_at Pnliprp1 20
1 1415884_at Cela3b 47
2 1415805_at Clps 17
3 1115805_at Ckkk 77
我該如何做到這一點?