DataFrame/ColumnLabels
obtain column labels of a DataFrame
DataFrame/RowLabels
obtain row labels of a DataFrame
DataFrame/SubsColumnLabel
create a DataFrame with a different column label
DataFrame/SubsRowLabel
create a DataFrame with a different row label
Calling Sequence
Parameters
Description
Examples
Compatibility
ColumnLabels(DF)
ColumnLabels(DF, i)
SubsColumnLabel(DF, i, label)
RowLabels(DF)
RowLabels(DF, i)
SubsRowLabel(DF, i, label)
DF
-
a DataFrame object
i
a nonzero integer or valid row or column label
label
a new label
The ColumnLabels command returns the list of column labels for a DataFrame object, or a single column label. A single label is specified by its position.
The RowLabels command returns the list of row labels for a DataFrame object, or a single row label. A single label is specified by its position.
The SubsColumnLabel command creates a DataFrame object with a different column label.
The SubsRowLabel command creates a DataFrame object with a different row label.
Note: the SubsColumnLabel and SubsRowLabel commands do not modify the given DataFrame object DF - they just return new DataFrame objects. See the Examples section below.
If i is a negative integer, it specifies the position counting from the end. For example, -2 specifies the label before last.
df≔DataFrame⁡5,6,8,8,9,1,9,6,0,2,5,9,columns=A,B,C,D,rows=a,b,c
df≔ABCDa5892b6965c8109
ColumnLabels⁡df
A,B,C,D
RowLabels⁡df
a,b,c
ColumnLabels⁡df,2
B
RowLabels⁡df,−1
c
The statements below does not modify df.
df2≔SubsColumnLabel⁡df,3,X
df2≔ABXDa5892b6965c8109
ColumnLabels⁡df2
A,B,X,D
SubsRowLabel⁡df,1,z
ABCDz5892b6965c8109
SubsRowLabel⁡df,a,S
ABCDS5892b6965c8109
We can make the change apply to df by assigning the result to df.
df≔SubsColumnLabel⁡df,3,X
df≔ABXDa5892b6965c8109
df≔SubsRowLabel⁡df,1,z
df≔ABXDz5892b6965c8109
z,b,c
The DataFrame/ColumnLabels, DataFrame/RowLabels, DataFrame/SubsColumnLabel and DataFrame/SubsRowLabel commands were introduced in Maple 2016.
For more information on Maple 2016 changes, see Updates in Maple 2016.
See Also
DataFrame
DataFrame/Constructor
DataFrame/indexing
DataSeries/Labels
Download Help Document