Write a python program using pandas to store the numbers 5 to 14 in series and display the series

The question , asked many times that , What if we want to display a series of numbers  5,6,7,8,9,10,11,12,13,14  (in  series) Using Pandas in python .
<Read This Till last : You will Get the Answer with proper code and screenshot of the result >
So it may be quite simple in python ☻ so  for that first we are going to print numbers in series using python .
For that we need to understand the concept of  Range Function in Python :

range() is a built-in function of Python. It is used when a user needs to perform an action for a specific number of times. range() in Python(3. x) is just a renamed version of a function called xrange in Python 2

In simple terms, range() allows user to generate a series of numbers within a given range. Depending on how many arguments user is passing to the function, user can decide where that series of numbers will begin and end as well as how big the difference will be between one number and the next.range() takes mainly three arguments.
SO the Range Is the Function Of python we use . Range function of python is simply define the range (English word) , As a question we can say :  from where to where !!Funny ?? Yes , You can say Python is just a language like English .
So come to the point Range : If You want to perform a task as a any example of Range in python then  you need to open your python IDLE or any Python IDE of your choice . I Normally Like to use Visual Code , and for more I love to use PYCHARM 

And simply Type this code :print(range(10))
It will show you some output , like :

range(0, 10)

This is the range of 10 ,  Here (0, 10 )  means range start from 0 and end at 10 .

Now go through this code :
print(list(range(10)))
This will Show you the Output :

[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]

In this Code you can see We had use the “list” , so “list” will show numbers , of range(10) , Which is 0,1,2,3,4,5,6,7,8,9 ( Question : Why not 10 ? Comment your Answer Now !) Now for Practice Please type these code Also , And Comment your Answer !! 
print(list(range(5, 10))) print(list(range(2, 20, 4)))

So After running all these code , I am sure your concept of RANGE should be clear , If you have any doubt then please ask me Now .

NOW  WE  ARE  ABLE  TO  TALK  ABOUT  OUR QUESTION  !!

So Our task Was : Write a python program using pandas to store the numbers 5 to 14 in series and display the series !
So here We are going to Use PANDAS and NUMPY .
I am not Going to talk about PANDAS or NUMPY much , but in short , we can discus about them according to google result :
PANDAS : In computer programming, pandas is a software library written for the Python programming language for data manipulation and analysis.

PIC from GOOGLE 
NUMPY : Numpy is the core library for scientific computing in Python. It provides a high-performance multidimensional array object, and tools for working with these arrays. 

So Directly I am going to Tell you the code :

import pandas as pd
import numpy as np

data= np.array(list(range(5,15)))
series= pd.Series(data)

print(series)

 Here , pandas is imported as pd (pd is short form , you can write any other ! but for better understanding we use pd)and numpy as np.
Now  in “data” we will store  the list of numbers , of range (5,15)  which will 5,6,7,8,9,10,11,12,13,14 . Here as described , 15 will not be stored in data .
Then we will use pandas and in series we will store the converted value of data as Series .
then we will print the series .
we will get the output as:

  C:\Users\raja\AppData\Local\Programs\Python\Python38-32\python.exe C:/Users/raja/PycharmProjects/pandas1/p1.py0     51     62     73     84     95    106    117    128    139    14dtype: int32

Screenshot of my Output

I Hope this will help you a lot . Thanks For reading full article , Wish you all the very best .

Learn More Python

SEE you Again ♥

Leave a Reply

Your email address will not be published.