Una colonna con nome e indice
Scopra cosa distingue una Series da una lista.
Una colonna con nome e indice è una lezione Data Science Academy gratuita su CoddyKit. Questa è la lezione 1 di 4. Puoi leggere la lezione completa qui gratuitamente — poi esercitati direttamente nel browser con un editor di codice integrato e un tutor IA disponibile 24/7. Fa parte del percorso di apprendimento Data Science Academy, e i tuoi progressi si sincronizzano tra il web e l'app CoddyKit. Il corso Data Science Academy include 4 lezioni in totale.
Parti di questa lezione non sono ancora state tradotte e vengono mostrate in inglese.
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! 🎉
Domande Frequenti
La lezione «Una colonna con nome e indice» è gratuita?
Sì — il testo completo di «Una colonna con nome e indice» è gratuito qui sul web. Per esercitarvi in modo interattivo (un editor di codice integrato e un tutor IA 24/7) e sbloccare il resto del corso Data Science Academy, passa a CoddyKit PRO. Il corso Data Science Academy include 4 lezioni in totale.
Cosa imparerò in «Una colonna con nome e indice»?
Scopra cosa distingue una Series da una lista. Eserciti Data Science Academy con codice pratico che esegui direttamente nel browser, e un tutor IA 24/7 risponde alle tue domande mentre lavori sulla lezione.
Ho bisogno di esperienza per iniziare Data Science Academy?
Non è richiesta alcuna esperienza precedente. Data Science Academy su CoddyKit è strutturato per principianti e studenti avanzati, quindi puoi iniziare da qui o dall'inizio e procedere al tuo ritmo. Questa è la lezione 1 di 4.
Quanto tempo richiede la lezione «Una colonna con nome e indice»?
La maggior parte delle lezioni CoddyKit richiede circa 5–10 minuti. Ogni lezione è breve e interattiva, quindi fai progressi costanti e riprendi esattamente da dove hai lasciato su web e app.
Posso scrivere ed eseguire codice in questa lezione Data Science Academy?
Sì. Ogni lezione Data Science Academy include un editor di codice integrato, quindi scrivi ed esegui codice reale direttamente nel tuo browser e ricevi feedback istantaneo dall'IA — nessuna configurazione locale necessaria.
Tutte le lezioni di questo corso
- Una colonna con nome e indice
- Accesso basato su etichette e su posizioni
- Calcoli e allineamento delle Series
- Contare e individuare i valori