Skip to content Skip to sidebar Skip to footer

How To Fill An Nparray With Another Array Starting At A Key In Python?

I have a dataframe, called x. This consists of 2 columns which looks like this (712, 2): SibSp Parch 731 0 0 230 1 0 627 0 0 831 1 1 3

Solution 1:

You may need adding values after the dataframe

newX[:, 1:] = x.values
newX
Out[171]: 
array([[0., 0., 0.],
       [0., 1., 0.],
       [0., 0., 0.],
       [0., 1., 1.],
       [0., 0., 0.]])

Post a Comment for "How To Fill An Nparray With Another Array Starting At A Key In Python?"