Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Aprenda The `head()` Method | Fetching Data from DataFrames
Pandas: First Steps
course content

Conteúdo do Curso

Pandas: First Steps

Pandas: First Steps

1. Getting Started
2. Basics of Dataframes
3. Fetching Data from DataFrames

book
The `head()` Method

The head() method is used to fetch the first few rows of a DataFrame.

By default, it fetches the first 5 rows, but you can specify how many rows you want using the n named paramter.

Syntax:

python

Example:

123456789101112131415
import pandas as pd # Create a simple DataFrame data = { 'Name': ['Alice', 'Bob', 'Charlie', 'David', 'Eva', 'Frank'], 'Age': [24, 30, 22, 29, 25, 28] } df = pd.DataFrame(data) print('Show the first 5 rows:') print(df.head()) print('Show the first 3 rows:') print(df.head(3))
copy
Tudo estava claro?

Como podemos melhorá-lo?

Obrigado pelo seu feedback!

Seção 3. Capítulo 1

Pergunte à IA

expand
ChatGPT

Pergunte o que quiser ou experimente uma das perguntas sugeridas para iniciar nosso bate-papo

course content

Conteúdo do Curso

Pandas: First Steps

Pandas: First Steps

1. Getting Started
2. Basics of Dataframes
3. Fetching Data from DataFrames

book
The `head()` Method

The head() method is used to fetch the first few rows of a DataFrame.

By default, it fetches the first 5 rows, but you can specify how many rows you want using the n named paramter.

Syntax:

python

Example:

123456789101112131415
import pandas as pd # Create a simple DataFrame data = { 'Name': ['Alice', 'Bob', 'Charlie', 'David', 'Eva', 'Frank'], 'Age': [24, 30, 22, 29, 25, 28] } df = pd.DataFrame(data) print('Show the first 5 rows:') print(df.head()) print('Show the first 3 rows:') print(df.head(3))
copy
Tudo estava claro?

Como podemos melhorá-lo?

Obrigado pelo seu feedback!

Seção 3. Capítulo 1
Sentimos muito que algo saiu errado. O que aconteceu?
some-alt