Python Practice › Pandas Programs › Program 12

Series to array

EasyPandas Programs · 12 of 95

Write a pandas program to convert a Series to a NumPy array.

Advertisement
Input
["54", "27.90", "sqa", "33.33", "tools"]
Output
['54' '27.90' 'sqa' '33.33' 'tools']

Approach

  1. to_numpy().

Solution

Python
import pandas as pdprint(pd.Series(["54", "27.90", "sqa", "33.33", "tools"]).to_numpy())
Output
['54' '27.90' 'sqa' '33.33' 'tools']

Learn the concept

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

More pandas programs

← All 95 Pandas Programs

Leave a Comment