Answers for "pandas dataframe to numpy 2d array"

0

convert a pandas df to a numpy array

x = df.to_numpy()
x
Posted by: Guest on August-02-2021
-1

how to convert pandas series to 2d numpy array

a = np.array(s.values.tolist())
print (a)
[[ 0.  0.]
 [ 0.  0.]
 [ 0.  0.]
 [ 0.  0.]
 [ 0.  0.]]
Posted by: Guest on July-11-2020

Python Answers by Framework

Browse Popular Code Answers by Language