Kolumna z nazwą i indeksem
Dowiedz się, czym Series różni się od listy.
Kolumna z nazwą i indeksem to bezpłatna lekcja Data Science Academy na CoddyKit. To lekcja 1 z 4. Możesz przeczytać całą lekcję poniżej za darmo — a potem ćwiczyć ją interaktywnie w przeglądarce z wbudowanym edytorem kodu i tutorem AI dostępnym 24/7. To część ścieżki edukacyjnej Data Science Academy, a Twój postęp synchronizuje się między webem a aplikacją CoddyKit. Kurs Data Science Academy zawiera 4 lekcji w sumie.
Części tej lekcji nie zostały jeszcze przetłumaczone i są wyświetlane po angielsku.
Meet the Series
A Series is pandas' one-dimensional column: a sequence of values that all share one name and one type. Think of it as a single spreadsheet column. 📊
More Than a List
A plain Python list just holds values in order. A Series pairs every value with a label, so each item has both a position and a name you can look up by.
Create One Quickly
Pass any list to pd.Series and pandas wraps it for you. This line below builds your very first Series from three numbers.
import pandas as pd
s = pd.Series([10, 20, 30])
print(s)The Hidden Index
Notice the numbers on the left of your output. That is the index: a label for every value. Without one supplied, pandas auto-numbers from 0.
Give It Real Labels
You can set meaningful labels with the index argument. Now each value is named, which makes lookups read like plain English. 🏷️
s = pd.Series([90, 75, 88], index=['Ada', 'Bo', 'Cy'])
print(s['Bo'])One Type Inside
Every Series carries a single dtype, like int64 or float64. Shared types are what let pandas run fast math across the whole column at once.
print(s.dtype)Name the Whole Series
A Series can also carry its own name, separate from the index. That name becomes the column header once the Series joins a DataFrame.
s.name = 'score'
print(s.name)Values and Index Apart
You can pull the two parts out on their own. The .values attribute gives the raw data array; .index gives the labels that tag it.
print(s.values)
print(s.index)Build From a Dict
Hand pd.Series a dictionary and the keys become the index automatically. It is the fastest way to build a labeled column in one step.
ages = pd.Series({'Ada': 36, 'Bo': 41})
print(ages)Length and Peek
len(s) tells you how many values sit inside, and .head() shows just the first few. Both are handy first checks on any Series.
print(len(s))
print(s.head(2))The Column Building Block
Stack several Series side by side and you get a DataFrame. So mastering the Series means you already understand half of pandas. 🧱
Quick Check
Let's lock in what a Series carries.
Recap
You learned a Series is a named, single-typed column where every value has an index label. It is the basic block that DataFrames are built from. Nice work! 🎉
Często zadawane pytania
Czy lekcja „Kolumna z nazwą i indeksem” jest bezpłatna?
Tak — pełny tekst „Kolumna z nazwą i indeksem” jest dostępny za darmo tutaj w sieci. Aby ćwiczyć ją interaktywnie (wbudowany edytor kodu i tutor AI dostępny 24/7) i odblokować resztę kursu Data Science Academy, przejdź na CoddyKit PRO. Kurs Data Science Academy zawiera 4 lekcji w sumie.
Co nauczysz się w „Kolumna z nazwą i indeksem”?
Dowiedz się, czym Series różni się od listy. Ćwiczysz Data Science Academy z praktycznym kodem, który uruchamiasz bezpośrednio w przeglądarce, a tutor AI dostępny 24/7 odpowiada na Twoje pytania podczas pracy nad lekcją.
Czy potrzebuję doświadczenia, aby zacząć Data Science Academy?
Nie wymagamy żadnego doświadczenia. Data Science Academy w CoddyKit jest strukturyzowany dla początkujących i zaawansowanych użytkowników, więc możesz zacząć tutaj lub od początku i uczyć się w swoim tempie. To lekcja 1 z 4.
Ile czasu zajmuje lekcja „Kolumna z nazwą i indeksem”?
Większość lekcji CoddyKit trwa około 5–10 minut. Każda lekcja to mały, interaktywny krok, dzięki czemu robisz systematyczne postępy i zawsze wracasz dokładnie do tego samego miejsca — na webie i w aplikacji.
Czy mogę pisać i uruchamiać kod w tej lekcji Data Science Academy?
Tak. Każda lekcja Data Science Academy zawiera wbudowany edytor kodu, więc piszesz i uruchamiasz prawdziwy kod bezpośrednio w przeglądarce i od razu otrzymujesz sprzężenie zwrotne od AI — bez konfiguracji na komputerze.
Wszystkie lekcje w tym kursie
- Kolumna z nazwą i indeksem
- Dostęp według etykiety a według pozycji
- Operacje na Series i wyrównywanie
- Zliczanie i wyszukiwanie wartości