Wide e long, e dati tidy
Perché la struttura determina ciò che si può fare.
Wide e long, e dati tidy è 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.
Two Ways to Lay Out a Table
The same numbers can sit in very different shapes. Mastering data layout is the first step to reshaping like a pro. 📐
What Wide Format Looks Like
In wide format, each category gets its own column, so one row holds many related values side by side.
Jan Feb Mar
Alice 10 12 15
Bob 8 9 11What Long Format Looks Like
In long format, those columns collapse into rows. One column names the variable, another holds its value.
name month value
Alice Jan 10
Alice Feb 12
Alice Mar 15Same Data, Different Shape
Nothing is lost going wide to long or back. You are only rearranging where each value lives, not changing any numbers.
Meet Tidy Data
Tidy data is a tight version of long format: each variable is a column, each observation a row, each value one cell.
Why Tidy Wins
Most pandas tools expect tidy input. When data is tidy, grouping, filtering, and plotting just work without awkward reshaping.
Spotting Untidy Tables
If column names are really values, like dates or product names, the table is untidy and probably needs to go long.
When Wide Is Better
Wide is great for humans to read and for cross-tab summaries. You often analyze in long, then pivot to wide for a final report.
The Reshaping Toolkit
Pandas gives you a small kit: melt goes wide to long, while pivot and pivot_table go long back to wide.
Layout Drives Your Code
Choosing a layout is a design decision. The right shape can turn a tangled analysis into one or two clean lines.
A Quick Mental Test
Ask one question of any table: does each row mean exactly one observation? If yes, you are probably already tidy.
Quick Check
Time to test your layout instincts.
Recap: Shape Comes First
You learned wide versus long and why tidy data powers pandas. Next you will pivot long data into clean cross-tabs. 🎯
Domande Frequenti
La lezione «Wide e long, e dati tidy» è gratuita?
Sì — il testo completo di «Wide e long, e dati tidy» è 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 «Wide e long, e dati tidy»?
Perché la struttura determina ciò che si può fare. 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 «Wide e long, e dati tidy»?
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
- Wide e long, e dati tidy
- pivot_table per tabelle incrociate
- melt per passare al formato long
- stack, unstack e MultiIndex