Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Impara Series | Getting Started
Pandas: First Steps
course content

Contenuti del Corso

Pandas: First Steps

Pandas: First Steps

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

book
Series

Importing Pandas

Before we can start working with Pandas, we need to import it:

py



Defining a Series

We can define a Series in Pandas using the following syntax:

python

The following code defines a new Series called populations representing the populations of various cities (in milions):

12345678
import pandas as pd populations = pd.Series( [8.9, 3.6, 2.7, 1.6], ["London", "Berlin", "Rome", "Budapest"] ) print(populations)
copy

In some cases you might see the following syntax of creating a Series, which has the same effect, except in this case we use a named parameter to specify the index_list for the sake of readibility:

py



The index Property

We can access the list of indices of a Series using the index property:

12345678
import pandas as pd populations = pd.Series( [8.9, 3.6, 2.7, 1.6], ["London", "Berlin", "Rome", "Budapest"] ) print(populations.index)
copy

1. What does the following code create?

2. What will be the output of the following code?

3. You must always specify the index parameter when creating a Series.

question mark

What does the following code create?

Select the correct answer

question mark

What will be the output of the following code?

Select the correct answer

question mark

You must always specify the index parameter when creating a Series.

Select the correct answer

Tutto è chiaro?

Come possiamo migliorarlo?

Grazie per i tuoi commenti!

Sezione 1. Capitolo 2

Chieda ad AI

expand
ChatGPT

Chieda pure quello che desidera o provi una delle domande suggerite per iniziare la nostra conversazione

course content

Contenuti del Corso

Pandas: First Steps

Pandas: First Steps

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

book
Series

Importing Pandas

Before we can start working with Pandas, we need to import it:

py



Defining a Series

We can define a Series in Pandas using the following syntax:

python

The following code defines a new Series called populations representing the populations of various cities (in milions):

12345678
import pandas as pd populations = pd.Series( [8.9, 3.6, 2.7, 1.6], ["London", "Berlin", "Rome", "Budapest"] ) print(populations)
copy

In some cases you might see the following syntax of creating a Series, which has the same effect, except in this case we use a named parameter to specify the index_list for the sake of readibility:

py



The index Property

We can access the list of indices of a Series using the index property:

12345678
import pandas as pd populations = pd.Series( [8.9, 3.6, 2.7, 1.6], ["London", "Berlin", "Rome", "Budapest"] ) print(populations.index)
copy

1. What does the following code create?

2. What will be the output of the following code?

3. You must always specify the index parameter when creating a Series.

question mark

What does the following code create?

Select the correct answer

question mark

What will be the output of the following code?

Select the correct answer

question mark

You must always specify the index parameter when creating a Series.

Select the correct answer

Tutto è chiaro?

Come possiamo migliorarlo?

Grazie per i tuoi commenti!

Sezione 1. Capitolo 2
Siamo spiacenti che qualcosa sia andato storto. Cosa è successo?
some-alt