[Python-Error] FutureWarning: elementwise comparison failed; returning scalar, but in the future will perform elementwise comparison

Seungsoo Lee·2022년 3월 3일
0

data science

목록 보기
1/4

코드를 작성하다가

FutureWarning: elementwise comparison failed; returning scalar, but in the future will perform elementwise comparison

이 에러가 발생하였다.

먼저 아래는 에러 발생 지점이다.

selected = data[(data[:,1] == code) & (data[:,0] == date)]

이 에러는 numpy array는 python string과는 비교 할 수 없어서 생긴거다.
data[:,1] == code 이런식으로 비교를 하면 scalar를 반환해서 이 오류가 발생하는것이다.

type에 맞게 바꿔주면 된다.

https://stackoverflow.com/questions/40659212/futurewarning-elementwise-comparison-failed-returning-scalar-but-in-the-futur

0개의 댓글