Search code examples
python-polars

Polars: How to reorder columns in a specific order?


I cannot find how to reorder columns in a polars dataframe in the polars DataFrame docs.


Solution

  • Turns out it is the same as pandas:

    df = df[['PRODUCT', 'PROGRAM', 'MFG_AREA', 'VERSION', 'RELEASE_DATE', 'FLOW_SUMMARY', 'TESTSUITE', 'MODULE', 'BASECLASS', 'SUBCLASS', 'Empty', 'Color', 'BINNING', 'BYPASS', 'Status', 'Legend']]