How to Convert Pandas Series to NumPy Array (With Examples)
https://www.statology.org/pandas-series-to-numpy-array16.06.2021 · import pandas as pd import numpy as np #define series x = pd. Series ([1, 2, 5, 6, 9, 12, 15]) #convert series to NumPy array new_array = x. to_numpy #view NumPy array new_array array([ 1, 2, 5, 6, 9, 12, 15]) #confirm data type type(new_array) numpy.ndarray Using the type() function, we confirm that the pandas Series has indeed been converted ...
How to Convert Pandas Series to NumPy Array (With Examples)
www.statology.org › pandas-series-to-numpy-arrayJun 16, 2021 · The following code shows how to convert a pandas Series to a NumPy array: import pandas as pd import numpy as np #define series x = pd.Series( [1, 2, 5, 6, 9, 12, 15]) #convert series to NumPy array new_array = x.to_numpy() #view NumPy array new_array array ( [ 1, 2, 5, 6, 9, 12, 15]) #confirm data type type (new_array) numpy.ndarray