I have a pandas DataFrame like so:
Col_A Col_B
0. 1 5
1. 2 6
2. 3 7
3. 4 8
I'm trying to do this to pass a and b as variables inside a function I'm defining. For this, a should be a numpy array of the values in column A but I'm not being able to do that.
So far I've tried:
a = np.empty(1); a.fill(df[0])
But it returns:
ValueError: Input object to FillWithScalar is not a scalar
df['A'].to_numpy()ordf['A'].valuesshould return column as a 1d numpy array.np.empty(1)creates an array with space for 1 float element. You can onlyfillit with a scalar.