공부중, Pandas Library에 내장되어있는, plot 함수로 차트를 그리는 예제가 나왔는데,
주피터 노트북에서 실행을 하니 아래와 같은 메세지만 나오고 실제 차트가 나오지 않는다...
Pandas 자체 내장 plot 함수 뿐만 아니라, 파이썬에서 유명한 plot library인 matplotlib을 돌려도 동일한 상태...
나중에 알고보니, matplotlib 에 show()라는 함수가 있어, xx.show()를 해줘야 최종적으로 차트가 보이는 구조로 동작하는 듯 했다. 그런데.. 인간의 욕심은 끝이 없듯이... 뭔가 plot 함수를 쓰면 바로 차트가 툭 튀어나와서 내 눈을 즐겁게 해주는 상황을 만들고 싶어졌다.
언제나 처럼 문제에 직면하면 매트릭스의 Oracle을 만나듯, 구글로 회귀를 하게되는데, 역시나! matplotlib 기반 차트를 보려면 아래와 같은 옵션을 사전 실행해줘야되더라. Pandas 내장 plot library또한 matplotlib을 가지고와서 쓰는 구조라서 그런지 모르겠는데, 여튼 아래와 같은 차트를 보려면 아래와 같이 '%' 기호로 시작하는 'python magic command'를 써줘야 한다.
결론만 이야기 하면,
%matplotlib inline: Image 형태로 차트를 노트북 내에 그림
%matplotlib notebook: chart를 cell에 그리되 Interactive 하기 사용자가 크기조절 등을 할 수 있는 mode로 보여줌
IPython has a set of predefined ‘magic functions’ that you can call with a command line style syntax. There are two kinds of magics, line-oriented and cell-oriented.Line magicsare prefixed with the%character and work much like OS command-line calls: they get as an argument the rest of the line, where arguments are passed without parentheses or quotes.Lines magicscan return results and can be used in the right hand side of an assignment.Cell magicsare prefixed with a double%%, and they are functions that get as an argument not only the rest of the line, but also the lines below it in a separate argument.
1. 우선 JDK를 설치해야한다. (1.7 version 이상.. 본인은 JAVA 9 SE를 사용... 뭐 버전은 1.7이상이면 다 가능한듯)
2. 설치한 JDK로 JAVA_HOME을 컴퓨터 환경변수에 잡는다.
(이후 확인은 cmd창세ㅓ java -verion 같은 걸로 잘 잡혔는지 확인해본다. )
3. 위 Konlpy 공식 홈피에서 제공하는 link를 통해 Jpype를 다운받은 후 먼저 'pip install 파일명' 을 입력해서 설치를 한다.
[주의 : python -V 명령을 통해 본인의 python version을 확인한 후 자신의 version과 컴퓨터환경(bit수)에 맞는 jpype 파일을 설치한다!
- python version : 파일명 내 cpxx(숫자) 형태의 문구가 들어있는데 이것이 파일이 지원하는 python version이라고 생각하면된다. 예를들어 JPype1-0.7.0-cp35-cp35m-win_amd64.whl (cp35)의 경우 python 3.5x 이런식으로...