본문 바로가기
Data Analysis/Pandas

pip를 이용한 Pandas 설치(python3+)

by 붕어고기 2017. 6. 5.
반응형

Pandas는 자료 구조와 데이터 분석을 위한 파이썬 라이브러리 입니다.

 

pip를 이용하면 손쉽게 pandas를 설치할 수 있습니다.

 

제 설치 환경은 아래와 같습니다.

  • macOS Sierra 10.12.5
  • Python 3.6.0
  • pip 9.0.1

파이썬, pip의 버전을 확인하는 방법은 -V(대문자) 옵션을 주면 됩니다.

#### Python version check ####
$ python3 -V
Python 3.6.0

#### Pip version check ####
$ pip3 -V
pip 9.0.1 from /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages (python 3.6)

#### Python3+ ####
$ pip3 install pandas

#### Python2 ####
$ pip install pandas

 

설치가 정상적으로 되었는지 확인하기 위해 pandas 패키지를 호출해 test function을 호출하겠습니다.

>>> import pandas as pd
>>> pd.test()
Running unit tests for pandas
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/pandas/util/nosetester.py", line 217, in test
    self._show_system_info()
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/pandas/util/nosetester.py", line 103, in _show_system_info
    nose = import_nose()
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/numpy/testing/utils.py", line 89, in import_nose
    raise ImportError(msg)
ImportError: Need nose >= 1.0.0 for tests - see http://nose.readthedocs.io

 

다음과 같은 에러가 발했는데, nose가 설치되지 않아서 생긴 문제이므로 nose를 설치해주면 됩니다.

그리고 위의 과정을 다시 반복하면 됩니다.

 

nose 패키지는 테스팅을 위해 사용됩니다.

#### install nose ####
$ pip3 install nose

>>> import pandas as pd
>>> pd.test()
Running unit tests for pandas
pandas version 0.19.2
numpy version 1.12.1
pandas is installed in /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/pandas
Python version 3.6.0 (v3.6.0:41df79263a11, Dec 22 2016, 17:23:13) [GCC 4.2.1 (Apple Inc. build 5666) (dot 3)]
nose version 1.3.7
/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/imp.py:216: FutureWarning: The pandas.rpy module is deprecated and will be removed in a future version. We refer to external packages like rpy2. 
See here for a guide on how to port your code to rpy2: http://pandas.pydata.org/pandas-docs/stable/r_interface.html
  return _load(spec)

 

참고

1. Pandas official Website

반응형

댓글