Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
DataFrame | The Very First Steps
Pandas First Steps
course content

Conteúdo do Curso

Pandas First Steps

Pandas First Steps

1. The Very First Steps
2. Reading Files in Pandas
3. Analyzing the Data

book
DataFrame

To recap, a Series is a one-dimensional data structure, similar to a list or a column in a spreadsheet. It holds data of the same type, with each element labeled by an index.

In contrast, a DataFrame is a versatile two-dimensional structure in Pandas, similar to a table or spreadsheet, with rows and columns. It can hold data of different types, with each column functioning as a Series. Like a spreadsheet, a DataFrame includes both an index and column labels, making it ideal for handling large, structured datasets.

To create a DataFrame object, you'll need to use a dictionary in conjunction with the .DataFrame() constructor.

123456
import pandas as pd people_data = {'name' : ['Ann', 'Alex', 'Kevin', 'Kate'], 'age' : [35, 12, 24, 45]} people_df = pd.DataFrame(people_data) print(people_df)
copy

Note

If you want to explicitly indicate that the variable represents a DataFrame, you can include df in the variable name, as shown in this example (people_df).

Tarefa
test

Swipe to show code editor

Create an animals DataFrame using the animals_data dictionary.

Switch to desktopMude para o desktop para praticar no mundo realContinue de onde você está usando uma das opções abaixo
Tudo estava claro?

Como podemos melhorá-lo?

Obrigado pelo seu feedback!

Seção 1. Capítulo 4
toggle bottom row

book
DataFrame

To recap, a Series is a one-dimensional data structure, similar to a list or a column in a spreadsheet. It holds data of the same type, with each element labeled by an index.

In contrast, a DataFrame is a versatile two-dimensional structure in Pandas, similar to a table or spreadsheet, with rows and columns. It can hold data of different types, with each column functioning as a Series. Like a spreadsheet, a DataFrame includes both an index and column labels, making it ideal for handling large, structured datasets.

To create a DataFrame object, you'll need to use a dictionary in conjunction with the .DataFrame() constructor.

123456
import pandas as pd people_data = {'name' : ['Ann', 'Alex', 'Kevin', 'Kate'], 'age' : [35, 12, 24, 45]} people_df = pd.DataFrame(people_data) print(people_df)
copy

Note

If you want to explicitly indicate that the variable represents a DataFrame, you can include df in the variable name, as shown in this example (people_df).

Tarefa
test

Swipe to show code editor

Create an animals DataFrame using the animals_data dictionary.

Switch to desktopMude para o desktop para praticar no mundo realContinue de onde você está usando uma das opções abaixo
Tudo estava claro?

Como podemos melhorá-lo?

Obrigado pelo seu feedback!

Seção 1. Capítulo 4
Switch to desktopMude para o desktop para praticar no mundo realContinue de onde você está usando uma das opções abaixo
We're sorry to hear that something went wrong. What happened?
some-alt