Answers for "x,y,z dataframe to matrix"

3

numpy arrauy to df

numpy_data = np.array([[1, 2], [3, 4]])
df = pd.DataFrame(data=numpy_data, index=["row1", "row2"], columns=["column1", "column2"])
print(df)
Posted by: Guest on September-10-2020
-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

Code answers related to "x,y,z dataframe to matrix"

Python Answers by Framework

Browse Popular Code Answers by Language