• 카테고리

    질문 & 답변
  • 세부 분야

    데이터 분석

  • 해결 여부

    미해결

seaborn 모듈 설치 이후 (맥북 > jupyter notebook)

21.03.08 23:01 작성 조회수 793

1

seaborn 설치 이후,

df = sns.load_dataset("iris")

를 입력했는데 다음과 같은 에러 메시지가 뜹니다.

원인이 무얼까요?

/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/http/client.py in connect(self)
   1423 
-> 1424             self.sock = self._context.wrap_socket(self.sock,
   1425                                                   server_hostname=server_hostname)

/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/ssl.py in wrap_socket(self, sock, server_side, do_handshake_on_connect, suppress_ragged_eofs, server_hostname, session)
    499         # ctx._wrap_socket()
--> 500         return self.sslsocket_class._create(
    501             sock=sock,

/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/ssl.py in _create(cls, sock, server_side, do_handshake_on_connect, suppress_ragged_eofs, server_hostname, context, session)
   1039                         raise ValueError("do_handshake_on_connect should not be specified for non-blocking sockets")
-> 1040                     self.do_handshake()
   1041             except (OSError, ValueError):

/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/ssl.py in do_handshake(self, block)
   1308                 self.settimeout(None)
-> 1309             self._sslobj.do_handshake()
   1310         finally:

SSLCertVerificationError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1122)

During handling of the above exception, another exception occurred:

URLError                                  Traceback (most recent call last)
<ipython-input-6-87515bdb8e81> in <module>
----> 1 df = sns.load_dataset("iris")
      2 df

/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/seaborn/utils.py in load_dataset(name, cache, data_home, **kws)
    483                                   os.path.basename(full_path))
    484         if not os.path.exists(cache_path):
--> 485             if name not in get_dataset_names():
    486                 raise ValueError(f"'{name}' is not one of the example datasets.")
    487             urlretrieve(full_path, cache_path)

/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/seaborn/utils.py in get_dataset_names()
    417     """
    418     url = "https://github.com/mwaskom/seaborn-data"
--> 419     with urlopen(url) as resp:
    420         html = resp.read()
    421 

/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/urllib/request.py in urlopen(url, data, timeout, cafile, capath, cadefault, context)
    212     else:
    213         opener = _opener
--> 214     return opener.open(url, data, timeout)
    215 
    216 def install_opener(opener):

/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/urllib/request.py in open(self, fullurl, data, timeout)
    515 
    516         sys.audit('urllib.Request', req.full_url, req.data, req.headers, req.get_method())
--> 517         response = self._open(req, data)
    518 
    519         # post-process response

/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/urllib/request.py in _open(self, req, data)
    532 
    533         protocol = req.type
--> 534         result = self._call_chain(self.handle_open, protocol, protocol +
    535                                   '_open', req)
    536         if result:

/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/urllib/request.py in _call_chain(self, chain, kind, meth_name, *args)
    492         for handler in handlers:
    493             func = getattr(handler, meth_name)
--> 494             result = func(*args)
    495             if result is not None:
    496                 return result

/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/urllib/request.py in https_open(self, req)
   1383 
   1384         def https_open(self, req):
-> 1385             return self.do_open(http.client.HTTPSConnection, req,
   1386                 context=self._context, check_hostname=self._check_hostname)
   1387 

/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/urllib/request.py in do_open(self, http_class, req, **http_conn_args)
   1343                           encode_chunked=req.has_header('Transfer-encoding'))
   1344             except OSError as err: # timeout error
-> 1345                 raise URLError(err)
   1346             r = h.getresponse()
   1347         except:

URLError: <urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1122)>

답변 2

·

답변을 작성해보세요.

2

장주명님의 프로필

장주명

2021.03.09

위의 방법이 안될 경우 https://raw.githubusercontent.com/mwaskom/seaborn-data/master/iris.csv 에서 다운 받은 다음 pandas로 직접 읽어들이면 될것 같습니다.

import pandas

df = pandas.read_csv('iris.csv')

직접 파일을 받아서 위의 코드로 변환해서 이용하면 될 것 같습니다.

출처 : http://doc.mindscale.kr/km/python/11.html

미뇨비님의 프로필

미뇨비

질문자

2021.03.09

안녕하세요, 장주명님

답변 감사드립니다!

복받으세요 :)

1

장주명님 답변 감사합니다. 위 방법으로 하셔도 되고요.

아마도 아나콘다로 파이썬을 설치하신게 아니라 직접 파이썬을 설치해서 사용하시는거 같습니다.

탐색기에서 Python 을 검색하시면 아래와 같은 파이썬 폴더를 찾으실 수 있을거에요.

파이썬 인증서가 설치되지 않아 발생하는 문제 같습니다.

Install Certificates.command 를 더블클릭하시면 설치하실 수 있을거에요.

9YSiPiq.png (1764×1096)

미뇨비님의 프로필

미뇨비

질문자

2021.03.09

안녕하세요, 박조은님

친절한 답변 감사드립니다.

말씀하신대로 하니까, 정상적으로 값이 출력되었습니다.

고맙습니다 :)