전체 글544 TypeError: randint(): argument 'size' (position 2) must be tuple of ints, not int TypeError: randint(): argument 'size' (position 2) must be tuple of ints, not int¶ randint 메서드를 사용할때 rand메서드와 같이 텐서의 사이즈를 입력하면 아래와 같은 에러가 발생합니다.¶ In [1]: import torch torch.randint(1,2) --------------------------------------------------------------------------- TypeError Traceback (most recent call last) /tmp/ipykernel_2374966/3186067014.py in 1 import torch ----> 2 torch.randint(1,2) TypeError:.. 2023. 9. 19. OSError: [E050] Can't find model 'en_core_web_sm'. It doesn't seem to be a Python package or a valid path to a data directory OSError: [E050] Can't find model 'en_core_web_sm'. It doesn't seem to be a Python package or a valid path to a data directory.¶ nlp = spacy.load('en_core_web_sm')을 실행하면 아래와 같은 에러가 나타날 수 있습니다¶ In [1]: import spacy nlp = spacy.load('en_core_web_sm') 2023-09-19 20:03:35.425924: W tensorflow/compiler/tf2tensorrt/utils/py_utils.cc:38] TF-TRT Warning: Could not find TensorRT /home/jin/anaconda.. 2023. 9. 19. UnicodeDecodeError: 'utf-8' codec can't decode byte 0xc0 in position 0: invalid start byte UnicodeDecodeError: 'utf-8' codec can't decode byte 0xc0 in position 0: invalid start byte¶ In [1]: # 바이트 타입 지정 에러 입니다 import pandas as pd pd.read_csv("tempdata.csv") --------------------------------------------------------------------------- UnicodeDecodeError Traceback (most recent call last) /tmp/ipykernel_2337038/2525476890.py in 1 # 바이트 타입 지정 에러 입니다 2 import pandas as pd ----> 3 pd.read_csv.. 2023. 9. 18. TypeError: unsupported operand type(s) for +: 'int' and 'str' TypeError: unsupported operand type(s) for +: 'int' and 'str'¶ In [1]: # 타입이 다른 두 변수간 연산이 일어날때 발생한는 에러이며 예시는 아래와 같습니다. 1 + "name" --------------------------------------------------------------------------- TypeError Traceback (most recent call last) /tmp/ipykernel_2336008/3257371006.py in 1 # 타입이 다른 두 변수간 연산이 일어날때 발생한는 에러이며 예시는 아래와 같습니다. ----> 2 1 + "name" TypeError: unsupported operand type(s) .. 2023. 9. 18. AttributeError: 'str' object has no attribute 'capabilities' AttributeError: 'str' object has no attribute 'capabilities'¶ 현재 selenium 은 크롬드라이브를 따로 다운받지 않아도 사용할 수 있는 기능을 제공하고 있습니다. 아래 코드와 같이 './chromedriver'를 불러오면 에러가 발생합니다. from selenium import webdriver driver = webdriver.Chrome('./chromedriver') --------------------------------------------------------------------------- AttributeError Traceback (most recent call last) ~/opt/anaconda3/lib/python.. 2023. 9. 13. 파이썬 튜플을 csv로 (tuple to csv) 파이썬 튜플을 csv로 (tuple to csv) data = [ ("비가 너무 많이 오네요","It's raining too much"), ("회의가 너무 많네요","There are too many meetings"), ("오늘은 성적이 잘나와서 기분이 좋아요","I feel good because I got good grades today.") ] file_name = 'translate.csv' col1 = "kor" col2 = "eng" with open(file_name, 'w+') as file: file.write(f"{col1}, {col2}\n") # column for item in data: file.write(f"{item[0]}, {item[1]}\n") # value 2023. 9. 4. 이전 1 ··· 21 22 23 24 25 26 27 ··· 91 다음