Create a Series

EasyPandas Programs · 1 of 95

Write a pandas program to create and display a one-dimensional Series.

Advertisement
Input
[15, 43, 88, 23]
Output
0    15
1    43
2    88
3    23
dtype: int64

Approach

  1. pd.Series(list); pandas adds an index 0, 1, 2, …

Solution

Python
import pandas as pds = pd.Series([15, 43, 88, 23])print(s)
Output
0    15
1    43
2    88
3    23
dtype: int64
Advertisement

Learn the concept

New to this topic? Read the lesson, then come back.

More pandas programs

← All 95 Pandas Programs