Righe, colonne e indice
Costruisca il modello mentale di un DataFrame.
Righe, colonne 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.
A Table You Can Code
A DataFrame is pandas' spreadsheet in code: rows and columns of data you can slice, sort, and compute on instantly. 📊
Two Axes, One Grid
Every DataFrame has two axes: rows run top to bottom, columns run left to right. Together they form one tidy grid of values.
Columns Are the Variables
Each column holds one variable, like price or city, and shares a single data type. Think of a column as one measured thing.
Rows Are the Records
Each row is one record: a customer, a day, a sale. Read a row across and you get the full story of one observation.
Meet the Index
The index is the label down the left side that names every row. By default it counts 0, 1, 2, but it can be anything unique.
df.indexColumns Have Labels Too
The column headers form their own label set, the columns attribute. You select data by these names instead of guessing positions.
df.columnsShape Tells the Size
The shape attribute returns rows and columns as a pair. shape[0] is your row count, shape[1] is your column count.
df.shape # (rows, cols)One Column Is a Series
Pull a single column and pandas hands you a Series: a one-dimensional labeled array. A DataFrame is really a stack of Series.
df["price"]Set a Meaningful Index
You can promote a column to be the index when it identifies rows, like an order id. It makes lookups clearer and faster.
df.set_index("order_id")Labels Drive Everything
Pandas aligns and joins data by labels, not row order. That is why a thoughtful index quietly powers most of your analysis.
Reset When You Need To
Need a plain counting index back? reset_index moves the current index into a column and gives you fresh 0-based labels.
df.reset_index()Quick Check
Time to test the mental model of a DataFrame.
Recap: The DataFrame Map
Rows are records, columns are variables, and the index labels every row. Know this map and the rest of pandas clicks. 🗺️
Domande Frequenti
La lezione «Righe, colonne e indice» è gratuita?
Sì — il testo completo di «Righe, colonne 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 «Righe, colonne e indice»?
Costruisca il modello mentale di un DataFrame. 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 «Righe, colonne 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
- Righe, colonne e indice
- Creare un DataFrame da zero
- head, info e describe
- Aggiungere, rinominare ed eliminare colonne