Ravindra BagaleCourses & study guides मराठी Track your progress

5. pandas DataFrames and Series

Data Science

5.2 head, info, dtypes

Steps in Jupyter

  1. Run the DataFrame code above.
  2. df.head() — first 5 rows (here all 3).
  3. df.shape — (3, 7) means 3 rows, 7 columns.
  4. df.info() — non-null counts and dtypes.
  5. df.dtypes — column types only.
  6. df.describe() — numeric summary (qty, amount).
  7. df["city"] or df.city — one Series.

What you should see. amount and qty as int64; text columns as object (string). Cancelled row still appears — filtering comes in Chapter 6.

Ravindra Bagale's Tip

The short form df.city works only when the column name is a simple word. If the name has a space, like order id, the dot form breaks, so use square brackets: df["order id"]. A good habit is to rename such columns to names like order_id right after you load the file.