Program to convert a NumPy array to a Pandas series.

In this python pandas program, we will convert a NumPy array to a Pandas series.

Steps to solve the program
  1. Import pandas library as pd.
  2. Import NumPy library as np.
  3. Create a NumPy array using np.array().
  4. Now convert that array to a Pandas series using pd.Series().
  5. Print the output.
				
					import numpy as np
import pandas as pd
array = np.array([5,3,8,9,0])
result = pd.Series(array)
print(result)
				
			

Output :

				
					0    5
1    3
2    8
3    9
4    0
dtype: int32
				
			

convert a dictionary to a series

change the data type of given a column or a Series

Leave a Comment