0Pricing
Data Science Academy · Lekcja

Otwieranie arkuszy Excela w pandas

Odczytywanie wybranych arkuszy i zakresów

Otwieranie arkuszy Excela w pandas to bezpłatna lekcja Data Science Academy na CoddyKit. To lekcja 2 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.

Excel Everywhere

Most teams still share data as spreadsheets. Good news: pandas opens them almost as easily as CSVs, so you rarely need Excel itself. 📊

The read_excel Call

To load a workbook, reach for read_excel. Give it the file path and pandas hands you a DataFrame just like before.

import pandas as pd
df = pd.read_excel("report.xlsx")

One Hidden Requirement

Behind the scenes pandas needs the openpyxl library to read xlsx files. Install it once and read_excel just works.

pip install openpyxl

Workbooks Have Many Sheets

A single workbook can hold several tabs. By default pandas reads only the first sheet, which is not always the one you want.

Choose a Sheet by Name

Pass sheet_name with the tab title to grab exactly the right one. Names are clearer and safer than relying on position.

df = pd.read_excel("report.xlsx",
  sheet_name="Q3")

Or Pick by Position

You can also select a sheet by its zero-based index. sheet_name=1 reads the second tab in the workbook.

df = pd.read_excel("report.xlsx", sheet_name=1)

Load Every Sheet at Once

Set sheet_name=None and pandas returns a dictionary mapping each tab name to its own DataFrame. Handy for whole workbooks.

all_sheets = pd.read_excel("report.xlsx",
  sheet_name=None)

Skip the Junk on Top

Excel files often start with a title or blank rows. Use skiprows to ignore them so the real header lands correctly.

df = pd.read_excel("report.xlsx", skiprows=3)

Read Just a Column Range

The usecols option accepts Excel letters like A:D, pulling only those columns straight from the sheet.

df = pd.read_excel("report.xlsx",
  usecols="A:D")

Set the Index on Load

Just like with CSVs, index_col promotes a column to the row index right as the spreadsheet is read.

df = pd.read_excel("report.xlsx",
  index_col="id")

Same Skills, New Source

Notice the pattern: read_excel shares most options with read_csv. Learn one reader and the others feel instantly familiar.

Quick Check

You want every tab in a workbook loaded at once. What do you set?

Recap: Excel Unlocked

You can open any workbook with read_excel: choose sheets by name or index, skip junk rows, and limit columns. Spreadsheets hold no secrets now. 🎉

Często zadawane pytania

Czy lekcja „Otwieranie arkuszy Excela w pandas” jest bezpłatna?

Tak — pełny tekst „Otwieranie arkuszy Excela w pandas” 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 „Otwieranie arkuszy Excela w pandas”?

Odczytywanie wybranych arkuszy i zakresów Ć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 2 z 4.

Ile czasu zajmuje lekcja „Otwieranie arkuszy Excela w pandas”?

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

  1. read_csv i jego przydatne opcje
  2. Otwieranie arkuszy Excela w pandas
  3. Parsowanie dat i ustawianie dtypes podczas wczytywania
  4. Zapisywanie wyników do CSV i Excela
← Powrót do Data Science Academy