i have tried to convert array to dataframe, and follow the documentation how to convert them.
here my script;
M = pd.DataFrame(a, columns=col)
c0 = M.quantile(0)
c1 = M.quantile(0.2)
c2 = M.quantile(0.4)
c3 = M.quantile(0.6)
c4 = M.quantile(0.8)
c5 = M.quantile(1)
d = np.array([c0,c1,c2,c3,c4,c5])
output_table_1 = pd.DataFrame(d)
the ouput has 6 rows, is not my expected that i want convert it to 6 columns. anyone can help me to solve this issue?
CodePudding user response:
Check the shape
of d
:
In [186]: d.shape
Out[186]: (6, 1)
In [187]: pd.DataFrame(d)
Out[187]:
0
0 0.0
1 0.6
2 1.2
3 1.8
4 2.4
5 3.0
With a (1,6) shape:
In [188]: pd.DataFrame(d.T)
Out[188]:
0 1 2 3 4 5
0 0.0 0.6 1.2 1.8 2.4 3.0