Reputation: 397
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
Upvotes: 0
Views: 800
Reputation: 98
You could take the column and turn it into a numpy array using the following:
a = np.array(df['Col_A'])
Upvotes: 1