Coding Exercise: Selecting Specific Rows and Columns

Objective:

Learn to select specific rows and columns from a DataFrame using pandas.

Instructions:

  1. Select rows from index 50 to 60 and print the result.

  2. Select specific columns:

  3. Display the rows of the selected columns.

Python Code:

#1

selected_rows = df[50:60]

selected_rows


#2.

selected_columns = df[['Customer ID', 'Age', 'Location']]

selected_columns