Selecting
df['revenue'] # a Series (one column)
df[['revenue', 'region']] # a DataFrame (double brackets)
Single brackets give a Series — a single labelled column. Double brackets give a DataFrame with one column. Most methods work on both, but some do not, and the error message rarely says so clearly.
Renaming
df = df.rename(columns={'rev': 'revenue', 'cust': 'customer'})
# clean every column at once
df.columns = df.columns.str.strip().str.lower().str.replace(' ', '_')
That second line is worth running on every messy import. It fixes trailing spaces and mixed case in one go, which otherwise cause KeyError on names that look correct.
Dropping
df = df.drop(columns=['notes', 'internal_id'])
df = df[['order_id', 'revenue', 'region']] # keep-only, and sets order
Selecting the columns you want is often clearer than dropping the ones you do not, and it fixes the column order at the same time.
Reassign or use inplace
Most pandas methods return a new DataFrame rather than modifying the original:
df.rename(columns={'a': 'b'})df = df.rename(columns={'a': 'b'})Forgetting the assignment is one of the most common early mistakes, and it fails silently — no error, no change.