0

I have multiple columns/values in dataframe and I want to do normality test.

So I need to get all values in single column.

I have tried, stack() and to_numpy() function but they return multiple array.

df.stack()

0    1    -0.138904
     2    -0.819545
     3    -0.765260
     4    -0.035203
     5     0.147615
             ...   
222  55   -0.407228
     56   -0.357614
     57   -0.455689
     58   -0.083255
     59   -0.334126
Length: 13157, dtype: float64

df.to_numpy()

array([[-0.13890365, -0.81954507, -0.76525984, ..., -0.07031505,
        -0.51522276, -0.33187401],
       [ 0.1606656 ,  0.01011122, -0.01753616, ...,  0.14043105,
         0.2430155 , -0.03276516],
       [-0.37554229, -0.05746348, -0.46619369, ..., -0.51693021,
        -0.34434628, -0.22732171],
       ...,
       [-0.0315992 , -0.58995652, -0.35898007, ...,  0.00513196,
        -0.69495718,  0.04492633],
       [-0.8875676 , -0.71248811, -0.67634478, ..., -0.95588916,
        -0.91959176, -0.93648983],
       [-0.09563407, -0.27279773,  0.06991731, ..., -0.45568943,
        -0.08325458, -0.33412561]])

I need single column like this:

1.114169
0.780083
0.843903
-0.193405
-0.192596
-0.234779
tyasird
  • 926
  • 1
  • 12
  • 29

1 Answers1

1

When you do to_numpy chain with stack

a = df.stack().to_numpy()
BENY
  • 317,841
  • 20
  • 164
  • 234