Search code examples
python-polars

How to change the first letter of the column name to upper case in Polars?


I need to change the first letter of all column names to upper case. Is there a quick way to do it? I've found only rename() and prefix() functions.


Solution

  • You can use df.columns (like in pandas):

    df.columns = [col.capitalize() for col in df.columns]