필터 지우기
필터 지우기

replace column name from a dataframe with his corresponding index

조회 수: 2 (최근 30일)
wejden hammami
wejden hammami 2020년 6월 21일
댓글: dpb 2020년 6월 21일
Hello, how can i replace a column name which is a string with the index of this column in a dataframe ?
In this case, i couldn't use :
featureNames = cellfun(@str2num,featureNames)
since my column names are strings which don't contain values like '2' then i could convert it to num with str2num.
NB: featureNames is an array which contain column names
Example: the first column of my dataframe is 'TCGA-AXV6' and i want to set it to 1
Can someone help me fix this problem please ?
  댓글 수: 1
dpb
dpb 2020년 6월 21일
I don't see a problem -- you can reference by column index the same as by variable name.
Show us the exact code/data structure that is giving rise to the perceived need...

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

Help CenterFile Exchange에서 Data Type Conversion에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by