Я хочу объединить фреймы данных pandas по столбцам и сбросить индекс.
import pandas as pd
import numpy as np
com_mut = kirc_mut.loc[common_samples]
com_mut = com_mut.sort_index()
com_mut = com_mut.T
com_mut = com_mut.dropna()
com_mut = com_mut.groupby(com_mut.index).first()
com_mut = com_mut.T
l=[com_mut[x].apply(pd.Series).stack() for x in com_mut.columns]
common_mut=pd.concat(l,1).reset_index(level=1,drop=True)
Обратная связь:
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
Input In [24], in ()
7 com_mut = com_mut.T
8 l=[com_mut[x].apply(pd.Series).stack() for x in com_mut.columns]
----> 9 common_mut=pd.concat(l,1).reset_index(level=1,drop=True)
10 common_mut.columns=com_mut.columns
12 common_mut
TypeError: concat() takes 1 positional argument but 2 were given
< /code>
data: < /p>
common_samples[1:10]
Index(['TCGA-A3-3367-01', 'TCGA-A3-3387-01', 'TCGA-B0-4698-01',
'TCGA-B0-4710-01', 'TCGA-B0-4810-01', 'TCGA-B0-4811-01',
'TCGA-B0-4815-01', 'TCGA-B0-4818-01', 'TCGA-B0-4821-01'],
dtype='object')
kirc_mut.iloc[0:9,0:9]
pd.DataFrame({'A1BG': {'TCGA-A3-3313-01': 0,
'TCGA-A3-3313-01A.': 0,
'TCGA-A3-3317-01': 1,
'TCGA-A3-3319-01': 0,
'TCGA-A3-3319-01A.': 0,
'TCGA-A3-3320-01': 0,
'TCGA-A3-3320-01A.': 0,
'TCGA-A3-3331-01': 0,
'TCGA-A3-3346-01': 0},
'A1CF': {'TCGA-A3-3313-01': 0,
'TCGA-A3-3313-01A.': 0,
'TCGA-A3-3317-01': 0,
'TCGA-A3-3319-01': 0,
'TCGA-A3-3319-01A.': 0,
'TCGA-A3-3320-01': 0,
'TCGA-A3-3320-01A.': 0,
'TCGA-A3-3331-01': 0,
'TCGA-A3-3346-01': 0},
'A2M': {'TCGA-A3-3313-01': 0,
'TCGA-A3-3313-01A.': 1,
'TCGA-A3-3317-01': 0,
'TCGA-A3-3319-01': 0,
'TCGA-A3-3319-01A.': 1,
'TCGA-A3-3320-01': 0,
'TCGA-A3-3320-01A.': 0,
'TCGA-A3-3331-01': 0,
'TCGA-A3-3346-01': 0},
'A2ML1': {'TCGA-A3-3313-01': 0,
'TCGA-A3-3313-01A.': 0,
'TCGA-A3-3317-01': 0,
'TCGA-A3-3319-01': 0,
'TCGA-A3-3319-01A.': 0,
'TCGA-A3-3320-01': 0,
'TCGA-A3-3320-01A.': 0,
'TCGA-A3-3331-01': 0,
'TCGA-A3-3346-01': 0},
'A4GNT': {'TCGA-A3-3313-01': 0,
'TCGA-A3-3313-01A.': 0,
'TCGA-A3-3317-01': 0,
'TCGA-A3-3319-01': 0,
'TCGA-A3-3319-01A.': 0,
'TCGA-A3-3320-01': 1,
'TCGA-A3-3320-01A.': 0,
'TCGA-A3-3331-01': 0,
'TCGA-A3-3346-01': 0},
'AAAS': {'TCGA-A3-3313-01': 0,
'TCGA-A3-3313-01A.': 1,
'TCGA-A3-3317-01': 0,
'TCGA-A3-3319-01': 0,
'TCGA-A3-3319-01A.': 0,
'TCGA-A3-3320-01': 0,
'TCGA-A3-3320-01A.': 0,
'TCGA-A3-3331-01': 0,
'TCGA-A3-3346-01': 0},
'AADAC': {'TCGA-A3-3313-01': 0,
'TCGA-A3-3313-01A.': 0,
'TCGA-A3-3317-01': 0,
'TCGA-A3-3319-01': 0,
'TCGA-A3-3319-01A.': 0,
'TCGA-A3-3320-01': 0,
'TCGA-A3-3320-01A.': 0,
'TCGA-A3-3331-01': 0,
'TCGA-A3-3346-01': 0},
'AADACL3': {'TCGA-A3-3313-01': 0,
'TCGA-A3-3313-01A.': 0,
'TCGA-A3-3317-01': 0,
'TCGA-A3-3319-01': 0,
'TCGA-A3-3319-01A.': 0,
'TCGA-A3-3320-01': 1,
'TCGA-A3-3320-01A.': 0,
'TCGA-A3-3331-01': 0,
'TCGA-A3-3346-01': 0},
'AADACL4': {'TCGA-A3-3313-01': 0,
'TCGA-A3-3313-01A.': 0,
'TCGA-A3-3317-01': 0,
'TCGA-A3-3319-01': 0,
'TCGA-A3-3319-01A.': 0,
'TCGA-A3-3320-01': 1,
'TCGA-A3-3320-01A.': 0,
'TCGA-A3-3331-01': 0,
'TCGA-A3-3346-01': 0}})
Подробнее здесь: https://stackoverflow.com/questions/764 ... were-given
Ошибка типа: concat() принимает 1 позиционный аргумент, но задано 2 ⇐ Python
-
- Похожие темы
- Ответы
- Просмотры
- Последнее сообщение