Q:

Write a Pandas program to convert a NumPy array to a Pandas series

0

Write a Pandas program to convert a NumPy array to a Pandas series.


Sample NumPy array: d1 = [10, 20, 30, 40, 50]

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

import numpy as np
import pandas as pd
np_array = np.array([10, 20, 30, 40, 50])
print("NumPy array:")
print(np_array)
new_series = pd.Series(np_array)
print("Converted Pandas series:")
print(new_series)

Sample Output:

  NumPy array:
[10 20 30 40 50]
Converted Pandas series:
0    10
1    20
2    30
3    40
4    50
dtype: int64

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

Similar questions


need a help?


find thousands of online teachers now