Pandas - How I use the set_index() method

Опубликовано: 23 Июль 2024
на канале: Learn Pandas
19
0

🔥 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")


Смотрите видео Pandas - How I use the set_index() method онлайн без регистрации, длительностью часов минут секунд в хорошем качестве. Это видео добавил пользователь Learn Pandas 23 Июль 2024, не забудьте поделиться им ссылкой с друзьями и знакомыми, на нашем сайте его посмотрели 19 раз и оно понравилось 0 людям.