0

I want to write a function that takes as input a row of a df and returns a numpy array (dtype=np.float64) that contains the values for a specific subset of columns in the row. In other words, using each column from a list of columns (col) as the index for the row parameter to get a value and store it in a numpy array.

df.columns = ['a', 'b', 'c']

col = ['a', 'c']

result = one np.array of values for each row in df[col]

ansev
  • 30,322
  • 5
  • 17
  • 31

0 Answers0