numpy.arrayの配列から値を取得したい
numpy.arrayを用いた配列の中から、取得したい値を検索し、printで表示させるようにしたいです。
しかし
 index = np.where(data[powering] == 2.35)
 IndexError: arrays used as indices must be of integer (or boolean) type
と言ったエラーがでてしまいます。今配列の中身は、小数も含まれているので、エラーに書かれてある、integerにはできない状態です。どのようにすれば、値を取得できるようにできるのでしょうか。
現在のpythonコードは下記のようになっています。
def content(volta, currenting, powering ):
  import numpy as np
  from math import floor
  from math import ceil
  a = np.array([volta, currenting, powering])
  support = np.round(a,2)
  data = np.transpose(support)
  sample = open("test.txt", "w")
  sample.write(str(data))
  sample.close()
  index = np.where(data[powering] == 2.35)
  if index == 2.35:
    vout = 2.9/(2.9 + data[currenting])
    print (str(vout))
    sleep(10)
  else:
    nextvalue = np.round(a,1)
    datatwo = np.transpose(nextvalue)