0% found this document useful (0 votes)
3 views9 pages

Lecture 3-15 April

The lecture covers key topics related to DataFrames in Python, including setting data types for columns, understanding dimensions, and retrieving subsets of data through indexing and slicing. It emphasizes the importance of ensuring correct data types for accurate data manipulation, illustrated with a real-life example from a pet store. The session includes practical coding examples to reinforce these concepts.

Uploaded by

ANE: Thundres
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views9 pages

Lecture 3-15 April

The lecture covers key topics related to DataFrames in Python, including setting data types for columns, understanding dimensions, and retrieving subsets of data through indexing and slicing. It emphasizes the importance of ensuring correct data types for accurate data manipulation, illustrated with a real-life example from a pet store. The session includes practical coding examples to reinforce these concepts.

Uploaded by

ANE: Thundres
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 9

Lecture 3- 15/04/2025

Topics-

1-setting teh data type of a column in a Dataframe.

2-Dimensions of a dataframe

3-Retrieving subset of a data- Indexing and slicing

4- Retrieving columns - Indexing by column name

1. Setting the Data Type of a Column in a DataFrame

What is it?
Every column in a DataFrame has a data type (like numbers, text, or decimals). Sometimes, you need to
change or set the type to make sure Python understands your data correctly—like telling it "this column is
numbers, not text."

Real-life Example:
In your pet store, you have a list of pets and their prices. The price might look like a number (e.g., 50), but
Python might think it’s text ("50"). You fix it to make sure it’s treated as a number so you can add prices later.

Python Example:
Let’s go through the code line by line so you fully understand what's happening:

You might also like