juniorPandas

How to add a new column in Pandas?

Updated May 17, 2026

Short answer

Assign a new column using df['col'] = values.

Deep explanation

Pandas aligns values by index when creating new columns. You can assign constants, computed values, or derived expressions.

Real-world example

Adding tax or discount columns in financial datasets.

Common mistakes

  • Mismatched index causing NaN values.

Follow-up questions

  • Can you insert column at specific position?
  • Does it modify original DataFrame?

More Pandas interview questions

View all →