close

How to create a series of numbers using Pandas in Python

Hello Guys, How are you all? Hope You all Are Fine. Today We Are Going To learn about How to create a series of numbers using Pandas in Python in Python. So Here I am Explain to you all the possible Methods here.

Without wasting your time, Let’s start This Article.

Table of Contents

How to create a series of numbers using Pandas in Python?

  1. How to create a series of numbers using Pandas in Python?

    This is the correct answer where you create a series using the numpy arange function which creates a range starting with 1 till 100 by incrementing 1.

  2. create a series of numbers using Pandas in Python

    This is the correct answer where you create a series using the numpy arange function which creates a range starting with 1 till 100 by incrementing 1.

Method 1

As seen in the docs for pandas.Series, all that is required for your data parameter is an array-like, dict, or scalar value. Hence to create a series for a range, you can do exactly the same as you would to create a list for a range.

one_to_hundred = pd.Series(range(1,101))

Method 2

one_to_hundred=pd.Series(np.arange(1,101,1))

This is the correct answer where you create a series using the numpy arange function which creates a range starting with 1 till 100 by incrementing 1.

Summery

It’s all About this issue. Hope all Methods helped you a lot. Comment below Your thoughts and your queries. Also, Comment below which Method worked for you? Thank You.

Also, Read