How to Choose the Columns of a pandas DataFrame with reindex
Tables often have more columns than you need, in an order you didn't choose. pandas picks columns by name in two ways: frame[[...]], which needs every name to exist, and reindex(columns=[...]), which adds an empty column for a name that doesn't. This guide picks columns both ways from a small table of test scores, including one column that isn't there, with real output from pandas 3.1.1.
