파이썬 input 값 변환

조회수 959회
data_pd = pd.read_excel('{}/{}'.format(Location,File),header = None, index_col=None, names=None)
data_pp = np.array(data_pd, str)
data_np = pd.DataFrame.to_numpy(data_pd)

inputBox = tkinter.Entry(window, text = " 코드입력 ")
inputBox.pack
inputBox.place(x=320, y=120)
code = inputBox.get()
def rreset():
    code = inputBox.get()
    MK0000052971 = 1
    MK0000050290 = 2
    MK0000025689 = 3
    MK0000036067 = 4
    MK0000027876 = 5
    MK0000027445 = 6
    MK0000061907 = 7
    MK0000027447 = 8
    MK0000062328 = 9
    MK0000072940 = 10
    label1.config(text=str(data_np[code][Column]))
    label1.pack()
    label1.place(x=320, y=0)

input 값에 MK0000052971 을 넣으면 ->1 로바뀌어 code 에 1 이들어가게 하고싶은데 MK0000052971이게 그대로 들어가서 오류가 납니다. code를 치면 1로 변환해서 넣을방법이 있을까요

  • (•́ ✖ •̀)
    알 수 없는 사용자
  • 1로 바뀌어 인트값이 들어가야하는데 MK0000052971같은 str이 들어가서 IndexError: only integers, slices (`:`), ellipsis (`...`), numpy.newaxis (`None`) and integer or boolean arrays are valid indices 이런오류가뜹니다 알 수 없는 사용자 2021.12.9 13:58

1 답변

답변을 하려면 로그인이 필요합니다.

프로그래머스 커뮤니티는 개발자들을 위한 Q&A 서비스입니다. 로그인해야 답변을 작성하실 수 있습니다.

(ಠ_ಠ)
(ಠ‿ಠ)