error 3

[Python] python float 'nan', 'inf' 처리

문제상황 txt에 nan과 inf, float 값이 저장된 파일을 읽어와서 다시 float 값으로 변환하고, nan과 inf는 경계값으로 설정하려 했는데 되지 않았다. 생각해보니 map(float, target_list)에서 에러가 생기지 않아서 'nan', 'inf' 모두 float 함수가 실행되긴 했다는 뜻이었다. print(float('nan')) # nan print(type(float('nan')) # print(float('nan') == float('nan')) # False print(float('nan') is float('nan')) # False print(float('nan') is type(float('nan'))) # False print(float('inf')) # inf 해결..

IT/Programming 2023.12.02

[Python] A load persistent id instruction was encountered,but no persistent_load function was specified. 해결

문제 상황 with open(f"./{dir_name}/agents/{id_code}", "rb") as file: saving_list.append(pickle.load(file)) Exception has occurred: UnpicklingError A load persistent id instruction was encountered, but no persistent_load function was specified. .pickle로 저장해둔 object를 불러오려 했는데, 에러가 발생했다. 해결 확장자에 주의한다!(.pickle) 코드를 수정하다가 .pickle이란 확장자를 지우고 파일 이름까지만 작성해둬서 파일이 제대로 인식되지 않은 것 같다. '.pickle' 이란 확장자를 명확히 기술하는 ..

IT/Programming 2023.07.02
1