Skip to main content
`Ctrl`+`K`

# pandas.DataFrame.columns

DataFrame.columns

  The column labels of the DataFrame.

  This property holds the column names as a pandas `Index` object. It provides an immutable sequence of column labels that can be used for data selection, renaming, and alignment in DataFrame operations.

  Returns:
    pandas.Index

      The column labels of the DataFrame.

  See also

  `DataFrame.index`

    The index (row labels) of the DataFrame.

  `DataFrame.axes`

    Return a list representing the axes of the DataFrame.

  Examples

      >>> df = pd.DataFrame({'A': [1, 2], 'B': [3, 4]})
      >>> df
              A  B
      0    1  3
      1    2  4
      >>> df.columns
      Index(['A', 'B'], dtype='str')