Using set_index() in Pandas DataFrame π
Learn how to set the index in a Pandas DataFrame in three simple steps. Free Pandas course available!

Learn Pandas
91 views β’ Jul 23, 2024

About this video
π₯ Free Pandas Course: https://hedaro.gumroad.com/l/tqqfq
How to set the index in a Pandas DataFrame in three easy steps:
1. Import the library
import pandas as pd
2. We create a simple table with two columns: "Inventory" and "Quantity".
Inventory Quantity
cars 234
airplanes 5
boats 44
We read in the data from the clipboard.
df = pd.read_clipboard()
3. Now, we want to use column "Inventory" as the index (label) for each row. We do this using the set_index() function.
df.set_index("Inventory")
How to set the index in a Pandas DataFrame in three easy steps:
1. Import the library
import pandas as pd
2. We create a simple table with two columns: "Inventory" and "Quantity".
Inventory Quantity
cars 234
airplanes 5
boats 44
We read in the data from the clipboard.
df = pd.read_clipboard()
3. Now, we want to use column "Inventory" as the index (label) for each row. We do this using the set_index() function.
df.set_index("Inventory")
Tags and Topics
Browse our collection to discover more content in these categories.
Video Information
Views
91
Likes
2
Duration
1:24
Published
Jul 23, 2024
Related Trending Topics
LIVE TRENDSRelated trending topics. Click any trend to explore more videos.